Skip to content

Commit afd27aa

Browse files
authored
Merge pull request #140 from github/tidy-dev/triaging-workflows
Add GitHub Actions for Issue Management
2 parents 28ed274 + df5bc5b commit afd27aa

File tree

8 files changed

+242
-0
lines changed

8 files changed

+242
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Close issue/PR on adding invalid label
2+
3+
# **What it does**: This action closes issues that are labeled as invalid in the repo.
4+
5+
on:
6+
issues:
7+
types: [labeled]
8+
9+
permissions:
10+
contents: read
11+
issues: write
12+
pull-requests: write
13+
14+
jobs:
15+
close-on-adding-invalid-label:
16+
if:
17+
github.repository == 'github/copilot-cli' && github.event.label.name ==
18+
'invalid'
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Close issue
23+
if: ${{ github.event_name == 'issues' }}
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
run: gh issue close ${{ github.event.issue.html_url }}
27+
28+
- name: Close PR
29+
if: ${{ github.event_name == 'pull_request_target' }}
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: gh pr close ${{ github.event.pull_request.html_url }}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Close Single-Word Issues
2+
3+
on:
4+
issues:
5+
types:
6+
- opened
7+
8+
permissions:
9+
issues: write
10+
11+
jobs:
12+
close-issue:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Close Single-Word Issue
17+
uses: actions/github-script@v7
18+
with:
19+
github-token: ${{ secrets.GITHUB_TOKEN }}
20+
script: |
21+
const issueTitle = context.payload.issue.title.trim();
22+
const isSingleWord = /^\S+$/.test(issueTitle);
23+
24+
if (isSingleWord) {
25+
const issueNumber = context.payload.issue.number;
26+
const repo = context.repo.repo;
27+
28+
// Close the issue and add the invalid label
29+
github.rest.issues.update({
30+
owner: context.repo.owner,
31+
repo: repo,
32+
issue_number: issueNumber,
33+
labels: ['invalid'],
34+
state: 'closed'
35+
});
36+
37+
// Comment on the issue
38+
await github.rest.issues.createComment({
39+
owner: context.repo.owner,
40+
repo: repo,
41+
issue_number: issueNumber,
42+
body: `This issue may have been opened accidentally. I'm going to close it now, but feel free to open a new issue with a more descriptive title.`
43+
});
44+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Add enhancement comment
2+
on:
3+
issues:
4+
types:
5+
- labeled
6+
7+
permissions:
8+
issues: write
9+
10+
jobs:
11+
add-comment-to-enhancement-issues:
12+
if: github.event.label.name == 'enhancement'
13+
runs-on: ubuntu-latest
14+
env:
15+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
GH_REPO: ${{ github.repository }}
17+
NUMBER: ${{ github.event.issue.number }}
18+
BODY: >
19+
Thank you for your issue! We have categorized it as an enhancement,
20+
and it has been added to our backlog. In doing so, **we are not
21+
committing to implementing this feature at this time**, but, we will
22+
consider it for future releases based on community feedback and our own
23+
product roadmap.
24+
25+
26+
**If you come across this issue and would like to see it implemented,
27+
please add a thumbs up!** This will help us prioritize the feature.
28+
Please only comment if you have additional information or viewpoints to
29+
contribute.
30+
steps:
31+
- run: gh issue comment "$NUMBER" --body "$BODY"

.github/workflows/no-response.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: No Response
2+
3+
# Both `issue_comment` and `scheduled` event types are required for this Action
4+
# to work properly.
5+
on:
6+
issue_comment:
7+
types: [created]
8+
schedule:
9+
# Schedule for five minutes after the hour, every hour
10+
- cron: '5 * * * *'
11+
12+
permissions:
13+
issues: write
14+
15+
jobs:
16+
noResponse:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: lee-dohm/[email protected]
20+
with:
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
closeComment: >
23+
Thank you for your issue!
24+
25+
We haven’t gotten a response to our questions above. With only the
26+
information that is currently in the issue, we don’t have enough
27+
information to take action. We’re going to close this but don’t
28+
hesitate to reach out if you have or find the answers we need. If
29+
you answer our questions above, this issue will automatically
30+
reopen.
31+
daysUntilClose: 7
32+
responseRequiredLabel: more-info-needed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Remove triage tab from closed issues
2+
on:
3+
issues:
4+
types:
5+
- closed
6+
jobs:
7+
label_issues:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
issues: write
11+
steps:
12+
- run: gh issue edit "$NUMBER" --remove-label "$LABELS"
13+
env:
14+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
GH_REPO: ${{ github.repository }}
16+
NUMBER: ${{ github.event.issue.number }}
17+
LABELS: triage
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Remove triage label
2+
on:
3+
issues:
4+
types:
5+
- labeled
6+
7+
permissions:
8+
issues: write
9+
10+
jobs:
11+
remove-triage-label-from-issues:
12+
if:
13+
github.event.label.name != 'triage' && github.event.label.name !=
14+
'more-info-needed'
15+
runs-on: ubuntu-latest
16+
steps:
17+
- run: gh issue edit "$NUMBER" --remove-label "$LABELS"
18+
env:
19+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
GH_REPO: ${{ github.repository }}
21+
NUMBER: ${{ github.event.issue.number }}
22+
LABELS: triage

.github/workflows/stale-issues.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'Marks stale issues and PRs'
2+
on:
3+
schedule:
4+
- cron: '30 1 * * *' # 1:30 AM UTC
5+
6+
permissions:
7+
issues: write
8+
9+
jobs:
10+
stale:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/stale@v9
14+
with:
15+
stale-issue-label: 'stale, triage' # The label that will be added to the issues when automatically marked as stale
16+
start-date: '2025-01-01T00:00:00Z' # Skip stale action for issues created before it
17+
days-before-stale: 365
18+
days-before-close: -1 # If -1, the issues nor pull requests will never be closed automatically.
19+
days-before-pr-stale: -1 # If -1, no pull requests will be marked as stale automatically.
20+
exempt-issue-labels: 'never-stale, help wanted' # issues labeled as such will be excluded them from being marked as stale
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Add unable-to-reproduce comment
2+
on:
3+
issues:
4+
types:
5+
- labeled
6+
7+
permissions:
8+
issues: write
9+
10+
jobs:
11+
add-comment-to-unable-to-reproduce-issues:
12+
if: github.event.label.name == 'unable-to-reproduce'
13+
runs-on: ubuntu-latest
14+
env:
15+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
GH_REPO: ${{ github.repository }}
17+
NUMBER: ${{ github.event.issue.number }}
18+
LABELS: more-info-needed
19+
BODY: >
20+
Thank you for your issue! Unfortunately, we are unable to reproduce the
21+
issue you are experiencing. Please provide more information so we can
22+
help you.
23+
24+
25+
Here are some tips for writing reproduction steps:
26+
- Step by step instructions accompanied by screenshots or screencasts
27+
are the best.
28+
- Be as specific as possible; include as much detail as you can.
29+
- If not already provided, include:
30+
- the version of Copilot CLI you are using.
31+
- the operating system you are using
32+
- any environment factors you can think of.
33+
- any custom configuration you are using.
34+
- a log file from the day you experienced the issue (find log
35+
files via `~/.copilot/logs`.
36+
- If relevant and can be shared, provide the repository or code you
37+
are using.
38+
- If relevant and can be shared, provide the session files (find session files via `~/.copilot/history-session-state`).
39+
40+
Note: This is a public repository. Please do not include any sensitive or
41+
private information in your issue.
42+
steps:
43+
- run: gh issue edit "$NUMBER" --add-label "$LABELS"
44+
- run: gh issue comment "$NUMBER" --body "$BODY"

0 commit comments

Comments
 (0)