-
Notifications
You must be signed in to change notification settings - Fork 1.8k
142 lines (126 loc) Β· 6.28 KB
/
Copy pathassign.yml
File metadata and controls
142 lines (126 loc) Β· 6.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
---
# Enables issue-claiming via comment commands (/assign-me, /unassign-me, /assign
# @user, /unassign @user) and automatically releases claims that have gone
# stale so issues don't sit locked to an inactive assignee.
#
# Reference: https://github.com/takanome-dev/assign-issue-action
name: Assign Issue
on:
schedule:
- cron: "0 6 * * *" # Runs daily; drives automatic unassignment/reminders
issue_comment:
types: [created]
workflow_dispatch:
jobs:
assign:
# Always run for scheduled/manual triggers. For comment triggers, only run
# when the comment plausibly contains an assign/unassign command, so we
# don't invoke the action on every unrelated issue comment in the repo.
if: >-
github.event_name != 'issue_comment' ||
contains(github.event.comment.body, '/assign') ||
contains(github.event.comment.body, '/unassign')
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Assign or unassign issue
uses: takanome-dev/assign-issue-action@c7086b052ac0039e7192085e82de2f9d74080f0b # v3.1.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
maintainers: 'joshua-stauffer'
required_label: 'ready-for-work'
assigned_label: 'claimed'
pin_label: 'pinned'
days_until_unassign: 7
enable_reminder: true
reminder_days: auto
allow_self_assign_author: false
enable_auto_suggestion: true
max_assignments: 3
block_assignment: true
# Override the action's default newcomer-welcome text: it links
# CONTRIBUTING.md with a relative path, which resolves to the
# issue's own URL instead of the repo file when rendered in an
# issue comment. Use an absolute link instead.
assigned_newcomer_text: |
### π Welcome to the Project!
Hey @{{ handle }}, thank you for your interest in this issue! π
We're excited to have you on board. Start by exploring our [Contributing guidelines](https://github.com/fivetran/great_expectations/blob/develop/CONTRIBUTING.md) and set up your local development workspace by following the steps in our documentation to get started smoothly.
> [!IMPORTANT]
> This issue will be automatically unassigned if idle for **{{ total_days }} days**.
<details>
<summary>βΉοΈ Helpful resources for first-time contributors</summary>
- Check out the project's README for setup instructions
- Read through the codebase documentation if available
- Don't hesitate to ask questions here on GitHub
- Please open a (draft) pull request early to show the direction you're heading towards
</details>
<details>
<summary>π Assignment details</summary>
- To prevent automatic unassignment, a maintainer can add the **{{{ pin_label }}}** label
- You can unassign yourself at any time by commenting with `/unassign-me`
- Updates and status reports are encouraged to show progress
</details>
Happy coding! π
# The assignment action above silently declines a `/assign-me` self-claim
# when the issue lacks the `ready-for-work` label β it posts no comment,
# so the contributor gets no explanation. Close that gap with a friendly
# note that says why the claim didn't take and points to the issues that
# are actually open for claiming. Only fires for self-claims on open
# issues that are missing the label; maintainer `/assign @user` and
# already-ready issues are unaffected.
- name: Explain why a not-ready issue can't be self-claimed
if: >-
github.event_name == 'issue_comment' &&
github.event.issue.state == 'open' &&
contains(github.event.comment.body, '/assign-me') &&
!contains(github.event.issue.labels.*.name, 'ready-for-work')
uses: actions/github-script@v7
with:
script: |
// Hidden marker so we can recognize our own note and avoid
// re-posting it every time a contributor re-comments `/assign-me`
// on the same not-ready issue (the event fires on each comment).
const MARKER = '<!-- assign-me:not-ready-for-work -->';
const issue_number = context.payload.issue.number;
const handle = context.payload.comment.user.login;
// Skip if we already left this note on the issue within the last
// day, mirroring the assignment action's own anti-spam window.
const since = new Date(Date.now() - 24 * 60 * 60 * 1000);
const recent = await github.paginate(github.rest.issues.listComments, {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number,
since: since.toISOString(),
per_page: 100,
});
if (recent.some((c) => c.body && c.body.includes(MARKER))) {
core.info(`Already explained on issue #${issue_number} recently; skipping.`);
return;
}
const readyUrl =
'https://github.com/fivetran/great_expectations/issues' +
'?q=is%3Aopen+label%3Aready-for-work+-label%3Aclaimed';
const body = [
`Thanks for your interest, @${handle}! π`,
'',
"This issue isn't marked **`ready-for-work`** yet, so it can't be " +
'self-claimed right now. Issues get that label once they have been ' +
'triaged and are ready for a contributor to pick up.',
'',
`π **[Browse issues that are ready to claim](${readyUrl})** ` +
'(open, `ready-for-work`, and not already claimed).',
'',
'Find one that interests you and comment `/assign-me` on it to claim it. ' +
'Happy contributing! π',
'',
MARKER,
].join('\n');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number,
body,
});
core.info(`Posted not-ready explanation on issue #${issue_number}.`);