Migrate issue triage workflows to shared workflows

This commit is contained in:
Kynan Ware 2026-02-12 23:32:45 -07:00
parent 4e65637471
commit a5e97b5b6c
8 changed files with 94 additions and 133 deletions

View file

@ -1,36 +0,0 @@
name: Add feature-request comment
on:
issues:
types:
- labeled
permissions:
issues: write
jobs:
add-comment-to-feature-request-issues:
if: github.event.label.name == 'enhancement'
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}
BODY: >
Thank you for your issue! We have categorized it as a feature request,
and it has been added to our backlog. In doing so, **we are not
committing to implementing this feature at this time**, but, we will
consider it for future releases based on community feedback and our own
product roadmap.
Unless you see the
https://github.com/cli/cli/labels/help%20wanted label, we are
not currently looking for external contributions for this feature.
**If you come across this issue and would like to see it implemented,
please add a thumbs up!** This will help us prioritize the feature.
Please only comment if you have additional information or viewpoints to
contribute.
steps:
- run: gh issue comment "$NUMBER" --body "$BODY"

View file

@ -1,25 +0,0 @@
name: Issue Automation
on:
issues:
types: [opened]
permissions:
contents: none
issues: write
jobs:
issue-auto:
runs-on: ubuntu-latest
environment: cli-automation
steps:
- name: label incoming issue
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.AUTOMATION_TOKEN }}
ISSUENUM: ${{ github.event.issue.number }}
ISSUEAUTHOR: ${{ github.event.issue.user.login }}
run: |
if ! gh api orgs/cli/public_members/$ISSUEAUTHOR --silent 2>/dev/null
then
gh issue edit $ISSUENUM --add-label "needs-triage"
fi

View file

@ -918,7 +918,7 @@ testData:
We have an automation to nudge on issues waiting for user info (like after one week), and close the issue if there's no further activity (like after one more week).
- Automatically add the stale label to issues labelled needs-user-input after 30 days of inactivity. When the stale label is added, also post a comment to the issue explaining what this means: the issue will close after 30 days of inactivity; contributors can comment on the issue to remove the stale label and keep it open. Maintainers can also add the keep label to make the stale automation ignore that issue.
- Automatically add the stale label to issues labelled more-info-needed after 30 days of inactivity. When the stale label is added, also post a comment to the issue explaining what this means: the issue will close after 30 days of inactivity; contributors can comment on the issue to remove the stale label and keep it open. Maintainers can also add the keep label to make the stale automation ignore that issue.
- Automatically close issues labelled stale after they have been stale for 30 days. When the issue is closed, add a comment explaining why this happened. Encourage them to leave a comment if the close was done in error.
- The above automation should only act on new issues after the date of the automation's implementation.
</BODY>

View file

@ -15,7 +15,7 @@ jobs:
start-date: "2025-07-10T00:00:00Z" # Skip for issues created before this date
days-before-issue-stale: 30
only-issue-labels:
"needs-triage,needs-user-input" # Only issues with all of these labels can be marked as stale
"needs-triage,more-info-needed" # Only issues with all of these labels can be marked as stale
exempt-issue-labels: "keep" # Issues marked with this label should not be marked as stale
stale-issue-label: "stale" # Mark stale issues with this label
stale-issue-message: |

61
.github/workflows/triage-issues.yml vendored Normal file
View file

@ -0,0 +1,61 @@
name: Issue Triaging
on:
issues:
types: [opened, reopened, labeled, unlabeled, closed]
jobs:
label-incoming:
if: github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'unlabeled'
uses: desktop/gh-cli-and-desktop-shared-workflows/.github/workflows/triage-label-incoming.yml@main
permissions:
issues: write
close-invalid:
if: github.event.action == 'labeled'
uses: desktop/gh-cli-and-desktop-shared-workflows/.github/workflows/triage-close-invalid.yml@main
permissions:
contents: read
issues: write
pull-requests: write
close-suspected-spam:
if: github.event.action == 'labeled'
uses: desktop/gh-cli-and-desktop-shared-workflows/.github/workflows/triage-close-suspected-spam.yml@main
permissions:
issues: write
close-single-word:
if: github.event.action == 'opened'
uses: desktop/gh-cli-and-desktop-shared-workflows/.github/workflows/triage-close-single-word-issues.yml@main
permissions:
issues: write
close-off-topic:
if: github.event.action == 'labeled'
uses: desktop/gh-cli-and-desktop-shared-workflows/.github/workflows/triage-close-off-topic.yml@main
permissions:
issues: write
enhancement-comment:
if: github.event.action == 'labeled'
uses: desktop/gh-cli-and-desktop-shared-workflows/.github/workflows/triage-enhancement-comment.yml@main
permissions:
issues: write
unable-to-reproduce:
if: github.event.action == 'labeled'
uses: desktop/gh-cli-and-desktop-shared-workflows/.github/workflows/triage-unable-to-reproduce-comment.yml@main
permissions:
issues: write
remove-needs-triage:
if: github.event.action == 'labeled'
uses: desktop/gh-cli-and-desktop-shared-workflows/.github/workflows/triage-remove-needs-triage.yml@main
permissions:
issues: write
on-issue-close:
if: github.event.action == 'closed'
uses: desktop/gh-cli-and-desktop-shared-workflows/.github/workflows/triage-on-issue-close.yml@main
permissions:
issues: write

View file

@ -0,0 +1,13 @@
name: Triage Scheduled Tasks
on:
workflow_dispatch:
issue_comment:
types: [created]
schedule:
- cron: '5 * * * *' # Hourly — no-response close
jobs:
no-response:
uses: desktop/gh-cli-and-desktop-shared-workflows/.github/workflows/triage-no-response-close.yml@main
permissions:
issues: write

View file

@ -5,70 +5,18 @@ on:
issues:
types:
- labeled
# pull_request_target (not pull_request) to access secrets for fork PRs.
# Safe: no PR code is checked out or executed.
pull_request_target:
types:
- labeled
env:
TARGET_REPO: github/cli
jobs:
issue:
environment: cli-discuss-automation
runs-on: ubuntu-latest
if: github.event_name == 'issues' && github.event.action == 'labeled' && github.event.label.name == 'discuss'
steps:
- name: Create issue based on source issue
env:
BODY: ${{ github.event.issue.body }}
CREATED: ${{ github.event.issue.created_at }}
GH_TOKEN: ${{ secrets.CLI_DISCUSSION_TRIAGE_TOKEN }}
LINK: ${{ github.repository }}#${{ github.event.issue.number }}
TITLE: ${{ github.event.issue.title }}
TRIGGERED_BY: ${{ github.triggering_actor }}
run: |
# Markdown quote source body by replacing newlines for newlines and markdown quoting
BODY="${BODY//$'\n'/$'\n'> }"
# Create issue using dynamically constructed body within heredoc
cat << EOF | gh issue create --title "Triage issue \"$TITLE\"" --body-file - --repo "$TARGET_REPO" --label triage
**Title:** $TITLE
**Issue:** $LINK
**Created:** $CREATED
**Triggered by:** @$TRIGGERED_BY
---
cc: @github/cli
> $BODY
EOF
pull_request:
runs-on: ubuntu-latest
environment: cli-discuss-automation
if: github.event_name == 'pull_request_target' && github.event.action == 'labeled' && github.event.label.name == 'discuss'
steps:
- name: Create issue based on source pull request
env:
BODY: ${{ github.event.pull_request.body }}
CREATED: ${{ github.event.pull_request.created_at }}
GH_TOKEN: ${{ secrets.CLI_DISCUSSION_TRIAGE_TOKEN }}
LINK: ${{ github.repository }}#${{ github.event.pull_request.number }}
TITLE: ${{ github.event.pull_request.title }}
TRIGGERED_BY: ${{ github.triggering_actor }}
run: |
# Markdown quote source body by replacing newlines for newlines and markdown quoting
BODY="${BODY//$'\n'/$'\n'> }"
# Create issue using dynamically constructed body within heredoc
cat << EOF | gh issue create --title "Triage PR \"$TITLE\"" --body-file - --repo "$TARGET_REPO" --label triage
**Title:** $TITLE
**Pull request:** $LINK
**Created:** $CREATED
**Triggered by:** @$TRIGGERED_BY
---
cc: @github/cli
> $BODY
EOF
discuss:
if: github.event.action == 'labeled'
uses: desktop/gh-cli-and-desktop-shared-workflows/.github/workflows/triage-discuss.yml@main
with:
target_repo: 'github/cli'
cc_team: '@github/cli'
secrets:
discussion_token: ${{ secrets.CLI_DISCUSSION_TRIAGE_TOKEN }}