From a82aa9784c0841431ecafeb22b909fe7f7197179 Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Thu, 23 Apr 2026 08:57:06 -0700 Subject: [PATCH] update workflows --- .../workflows/community-feedback-closer.yml | 61 +++++++++++++++++++ .github/workflows/info-needed-closer.yml | 4 +- .github/workflows/issue-labels.yml | 33 ++++++++++ .github/workflows/lock-issues.yml | 24 ++++++++ .github/workflows/pr-file-check.yml | 43 +++++++++++++ 5 files changed, 163 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/community-feedback-closer.yml create mode 100644 .github/workflows/issue-labels.yml create mode 100644 .github/workflows/lock-issues.yml create mode 100644 .github/workflows/pr-file-check.yml diff --git a/.github/workflows/community-feedback-closer.yml b/.github/workflows/community-feedback-closer.yml new file mode 100644 index 00000000..a6c0904f --- /dev/null +++ b/.github/workflows/community-feedback-closer.yml @@ -0,0 +1,61 @@ +name: Community Feedback Closer + +on: + schedule: + - cron: '30 12 * * *' # 5:30am Redmond, daily + workflow_dispatch: + +permissions: + issues: write + +jobs: + close-stale-feedback: + runs-on: ubuntu-latest + steps: + - name: Close community feedback issues lacking upvotes + uses: actions/github-script@v7 + with: + script: | + const label = 'needs community feedback'; + const requiredUpvotes = 7; + const maxAgeDays = 60; + const cutoffDate = new Date(Date.now() - maxAgeDays * 24 * 60 * 60 * 1000); + + const issues = await github.paginate(github.rest.issues.listForRepo, { + owner: context.repo.owner, + repo: context.repo.repo, + labels: label, + state: 'open', + per_page: 100, + }); + + for (const issue of issues) { + const createdAt = new Date(issue.created_at); + if (createdAt > cutoffDate) { + core.info(`#${issue.number} is only ${Math.floor((Date.now() - createdAt) / 86400000)} days old, skipping.`); + continue; + } + + const upvotes = issue.reactions?.['+1'] ?? 0; + if (upvotes >= requiredUpvotes) { + core.info(`#${issue.number} has ${upvotes} upvotes (>= ${requiredUpvotes}), keeping open.`); + continue; + } + + core.info(`Closing #${issue.number} (${upvotes} upvotes, created ${issue.created_at}).`); + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + 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!`, + }); + + await github.rest.issues.update({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + state: 'closed', + state_reason: 'not_planned', + }); + } diff --git a/.github/workflows/info-needed-closer.yml b/.github/workflows/info-needed-closer.yml index 5d345812..77dea5e0 100644 --- a/.github/workflows/info-needed-closer.yml +++ b/.github/workflows/info-needed-closer.yml @@ -27,7 +27,7 @@ jobs: with: token: ${{secrets.GITHUB_TOKEN}} label: info-needed - closeDays: 14 + closeDays: 7 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!" - pingDays: 14 + pingDays: 7 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." diff --git a/.github/workflows/issue-labels.yml b/.github/workflows/issue-labels.yml new file mode 100644 index 00000000..5005b4a3 --- /dev/null +++ b/.github/workflows/issue-labels.yml @@ -0,0 +1,33 @@ +name: Issue labels + +on: + issues: + types: [opened, reopened] + +env: + TRIAGERS: '["karthiknadig","eleanorjboyd","anthonykim1"]' + +permissions: + issues: write + +jobs: + add-classify-label: + name: "Add 'triage-needed' and remove assignees" + runs-on: ubuntu-latest + steps: + - name: Checkout Actions + uses: actions/checkout@v4 + with: + repository: 'microsoft/vscode-github-triage-actions' + ref: stable + path: ./actions + persist-credentials: false + + - name: Install Actions + run: npm install --production --prefix ./actions + + - name: "Add 'triage-needed' and remove assignees" + uses: ./actions/python-issue-labels + with: + triagers: ${{ env.TRIAGERS }} + token: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/lock-issues.yml b/.github/workflows/lock-issues.yml new file mode 100644 index 00000000..544d04ee --- /dev/null +++ b/.github/workflows/lock-issues.yml @@ -0,0 +1,24 @@ +name: 'Lock Issues' + +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + +permissions: + issues: write + +concurrency: + group: lock + +jobs: + lock-issues: + runs-on: ubuntu-latest + steps: + - name: 'Lock Issues' + uses: dessant/lock-threads@7266a7ce5c1df01b1c6db85bf8cd86c737dadbe7 # v6.0.0 + with: + github-token: ${{ github.token }} + issue-inactive-days: '30' + process-only: 'issues' + log-output: true diff --git a/.github/workflows/pr-file-check.yml b/.github/workflows/pr-file-check.yml new file mode 100644 index 00000000..daa7f50c --- /dev/null +++ b/.github/workflows/pr-file-check.yml @@ -0,0 +1,43 @@ +name: PR files + +on: + pull_request: + types: + - 'opened' + - 'reopened' + - 'synchronize' + - 'labeled' + - 'unlabeled' + +permissions: {} + +jobs: + changed-files-in-pr: + name: 'Check for changed files' + runs-on: ubuntu-latest + steps: + - name: 'package-lock.json matches package.json' + uses: brettcannon/check-for-changed-files@871d7b8b5917a4f6f06662e2262e8ffc51dff6d1 # v1.2.1 + with: + prereq-pattern: 'package.json' + file-pattern: 'package-lock.json' + skip-label: 'skip package*.json' + failure-message: '${prereq-pattern} was edited but ${file-pattern} was not (the ${skip-label} label can be used to pass this check)' + + - name: 'package.json matches package-lock.json' + uses: brettcannon/check-for-changed-files@871d7b8b5917a4f6f06662e2262e8ffc51dff6d1 # v1.2.1 + with: + prereq-pattern: 'package-lock.json' + file-pattern: 'package.json' + skip-label: 'skip package*.json' + failure-message: '${prereq-pattern} was edited but ${file-pattern} was not (the ${skip-label} label can be used to pass this check)' + + - name: 'Tests' + uses: brettcannon/check-for-changed-files@871d7b8b5917a4f6f06662e2262e8ffc51dff6d1 # v1.2.1 + with: + prereq-pattern: src/**/*.ts + file-pattern: | + src/**/*.test.ts + src/**/*.unit.test.ts + skip-label: 'skip tests' + failure-message: 'TypeScript code was edited without also editing a test file (the ${skip-label} label can be used to pass this check)'