Skip to content

Commit 023f4be

Browse files
authored
update workflows (microsoft#1475)
closeDays/pingDays 14 → 7 Locks closed issues after 30 days of inactivity Auto-adds triage-needed + removes assignees on issue open/reopen Closes needs community feedback issues after 60 days if <7 upvotes
1 parent e572f08 commit 023f4be

5 files changed

Lines changed: 163 additions & 2 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Community Feedback Closer
2+
3+
on:
4+
schedule:
5+
- cron: '30 12 * * *' # 5:30am Redmond, daily
6+
workflow_dispatch:
7+
8+
permissions:
9+
issues: write
10+
11+
jobs:
12+
close-stale-feedback:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Close community feedback issues lacking upvotes
16+
uses: actions/github-script@v7
17+
with:
18+
script: |
19+
const label = 'needs community feedback';
20+
const requiredUpvotes = 7;
21+
const maxAgeDays = 60;
22+
const cutoffDate = new Date(Date.now() - maxAgeDays * 24 * 60 * 60 * 1000);
23+
24+
const issues = await github.paginate(github.rest.issues.listForRepo, {
25+
owner: context.repo.owner,
26+
repo: context.repo.repo,
27+
labels: label,
28+
state: 'open',
29+
per_page: 100,
30+
});
31+
32+
for (const issue of issues) {
33+
const createdAt = new Date(issue.created_at);
34+
if (createdAt > cutoffDate) {
35+
core.info(`#${issue.number} is only ${Math.floor((Date.now() - createdAt) / 86400000)} days old, skipping.`);
36+
continue;
37+
}
38+
39+
const upvotes = issue.reactions?.['+1'] ?? 0;
40+
if (upvotes >= requiredUpvotes) {
41+
core.info(`#${issue.number} has ${upvotes} upvotes (>= ${requiredUpvotes}), keeping open.`);
42+
continue;
43+
}
44+
45+
core.info(`Closing #${issue.number} (${upvotes} upvotes, created ${issue.created_at}).`);
46+
47+
await github.rest.issues.createComment({
48+
owner: context.repo.owner,
49+
repo: context.repo.repo,
50+
issue_number: issue.number,
51+
body: `This feature request has not received the 7 community upvotes needed to be considered for future planning within 60 days of its creation. We are closing this issue, but if the community rallies behind it in the future, we are happy to reconsider. Thank you for your feedback!\n\nHappy Coding!`,
52+
});
53+
54+
await github.rest.issues.update({
55+
owner: context.repo.owner,
56+
repo: context.repo.repo,
57+
issue_number: issue.number,
58+
state: 'closed',
59+
state_reason: 'not_planned',
60+
});
61+
}

.github/workflows/info-needed-closer.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
with:
2828
token: ${{secrets.GITHUB_TOKEN}}
2929
label: info-needed
30-
closeDays: 14
30+
closeDays: 7
3131
closeComment: "Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off. \n\nHappy Coding!"
32-
pingDays: 14
32+
pingDays: 7
3333
pingComment: "Hey @${assignee}, this issue might need further attention.\n\n@${author}, you can help us out by closing this issue if the problem no longer exists, or adding more information."

.github/workflows/issue-labels.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Issue labels
2+
3+
on:
4+
issues:
5+
types: [opened, reopened]
6+
7+
env:
8+
TRIAGERS: '["karthiknadig","eleanorjboyd","anthonykim1"]'
9+
10+
permissions:
11+
issues: write
12+
13+
jobs:
14+
add-classify-label:
15+
name: "Add 'triage-needed' and remove assignees"
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout Actions
19+
uses: actions/checkout@v4
20+
with:
21+
repository: 'microsoft/vscode-github-triage-actions'
22+
ref: stable
23+
path: ./actions
24+
persist-credentials: false
25+
26+
- name: Install Actions
27+
run: npm install --production --prefix ./actions
28+
29+
- name: "Add 'triage-needed' and remove assignees"
30+
uses: ./actions/python-issue-labels
31+
with:
32+
triagers: ${{ env.TRIAGERS }}
33+
token: ${{secrets.GITHUB_TOKEN}}

.github/workflows/lock-issues.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: 'Lock Issues'
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
workflow_dispatch:
7+
8+
permissions:
9+
issues: write
10+
11+
concurrency:
12+
group: lock
13+
14+
jobs:
15+
lock-issues:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: 'Lock Issues'
19+
uses: dessant/lock-threads@7266a7ce5c1df01b1c6db85bf8cd86c737dadbe7 # v6.0.0
20+
with:
21+
github-token: ${{ github.token }}
22+
issue-inactive-days: '30'
23+
process-only: 'issues'
24+
log-output: true
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: PR files
2+
3+
on:
4+
pull_request:
5+
types:
6+
- 'opened'
7+
- 'reopened'
8+
- 'synchronize'
9+
- 'labeled'
10+
- 'unlabeled'
11+
12+
permissions: {}
13+
14+
jobs:
15+
changed-files-in-pr:
16+
name: 'Check for changed files'
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: 'package-lock.json matches package.json'
20+
uses: brettcannon/check-for-changed-files@871d7b8b5917a4f6f06662e2262e8ffc51dff6d1 # v1.2.1
21+
with:
22+
prereq-pattern: 'package.json'
23+
file-pattern: 'package-lock.json'
24+
skip-label: 'skip package*.json'
25+
failure-message: '${prereq-pattern} was edited but ${file-pattern} was not (the ${skip-label} label can be used to pass this check)'
26+
27+
- name: 'package.json matches package-lock.json'
28+
uses: brettcannon/check-for-changed-files@871d7b8b5917a4f6f06662e2262e8ffc51dff6d1 # v1.2.1
29+
with:
30+
prereq-pattern: 'package-lock.json'
31+
file-pattern: 'package.json'
32+
skip-label: 'skip package*.json'
33+
failure-message: '${prereq-pattern} was edited but ${file-pattern} was not (the ${skip-label} label can be used to pass this check)'
34+
35+
- name: 'Tests'
36+
uses: brettcannon/check-for-changed-files@871d7b8b5917a4f6f06662e2262e8ffc51dff6d1 # v1.2.1
37+
with:
38+
prereq-pattern: src/**/*.ts
39+
file-pattern: |
40+
src/**/*.test.ts
41+
src/**/*.unit.test.ts
42+
skip-label: 'skip tests'
43+
failure-message: 'TypeScript code was edited without also editing a test file (the ${skip-label} label can be used to pass this check)'

0 commit comments

Comments
 (0)