Skip to content

Commit

Permalink
Add new GitHub workflows for better automation and issue tracking(#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
kellertk authored Oct 21, 2024
1 parent 5d97201 commit 682f66a
Show file tree
Hide file tree
Showing 5 changed files with 236 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ body:
The code sample should be an SSCCE. See http://sscce.org/ for details. In short, please provide a code sample that we can copy/paste, run and reproduce.
validations:
required: true
- type: checkboxes
id: regression
attributes:
label: Regression Issue
description: What is a regression? If it worked in a previous version but doesn't in the latest version, it's considered a
regression. In this case, please provide specific version number in the report.
options:
- label: Select this option if this issue appears to be a regression.
required: false
- type: textarea
id: solution
attributes:
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/close_stale_issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: 'Close stale issues'
on:
schedule:
- cron: '0 0 * * *'

jobs:
cleanup:
runs-on: ubuntu-latest
name: Stale issue cleanup
steps:
- uses: aws-actions/stale-issue-cleanup@v6
with:
issue-types: 'issues,pull_requests'
ancient-issue-message: >
This issue has been automatically closed due to inactivity. If you
believe this was closed in error, please create a new issue and
link to this auto-closed issue. Thank you.
stale-issue-message: >
This issue has not received a response in one week. If you wish to
keep this open, please leave a comment and auto-close will be
cancelled.
stale-pr-message: >
This pull request has not received a response in one week. If you
wish to keep this open, please leave a comment and auto-close will
be cancelled.
stale-issue-label: closing-soon
exempt-issue-labels: automation-exempt
stale-pr-label: no-pr-activity
response-requested-label: response-requested
closed-for-staleness-label: closed-for-staleness
days-before-stale: 10
days-before-close: 4
days-before-ancient: 36500
minimum-upvotes-to-exempt: 2
repo-token: ${{ secrets.GITHUB_TOKEN }}
use-created-date-for-ancient: false
dry-run: false
#loglevel: debug
16 changes: 16 additions & 0 deletions .github/workflows/closed_issue_notice.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Closed Issue Message
on:
issues:
types: [closed]

jobs:
auto_comment:
runs-on: ubuntu-latest
steps:
- uses: aws-actions/closed-issue-message@v1
with:
# These inputs are both required
repo-token: "${{ secrets.GITHUB_TOKEN }}"
message: |
This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
140 changes: 140 additions & 0 deletions .github/workflows/issue_labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: Update repository labels

on:
workflow_dispatch:

jobs:
create-labels:
runs-on: ubuntu-latest
permissions:
issues: write
env:
LABELS: |
[
{
"name": "bug",
"color": "d73a4a",
"description": "This is a bug report"
},
{
"name": "feature-request",
"color": 8672,
"description": "This is regarding a missing feature"
},
{
"name": "documentation",
"color": "f7bc35",
"description": "This is a problem with published documentation"
},
{
"name": "announcement",
"color": "ff9900",
"description": "This is an announcement issue"
},
{
"name": "automation-exempt",
"color": "c5def5"
},
{
"name": "blocked",
"color": "86499b",
"description": "Work on this issue is blocked"
},
{
"name": "closed-for-staleness",
"color": "ededed",
"description": "This issue was closed due to inactivity"
},
{
"name": "closing-soon",
"color": 0,
"description": "This issue will close soon unless further comments are made"
},
{
"name": "duplicate",
"color": "cfd3d7",
"description": "This issue or pull request already exists"
},
{
"name": "investigating",
"color": "0000ff",
"description": "This issue is under investigation"
},
{
"name": "needs-review",
"color": "f996e2",
"description": "This issue needs to be reviewed by a core team member"
},
{
"name": "needs-triage",
"color": "c7cafc",
"description": "This issue has not yet been looked at by the team"
},
{
"name": "p0",
"color": "ff0000",
"description": "This issue is of the highest priority"
},
{
"name": "p1",
"color": "ff4500",
"description": "This is a high priority issue"
},
{
"name": "p2",
"color": "ff8c00",
"description": "This is a standard priority issue"
},
{
"name": "p3",
"color": "f5deb3",
"description": "This is a low priority issue"
},
{
"name": "potential-regression",
"color": "ff6700",
"description": "This issue may be a regression"
},
{
"name": "queued",
"color": "c6c8c6",
"description": "This issue is in our backlog"
},
{
"name": "service-api",
"color": "e06a18",
"description": "This issue is related to the service API"
},
{
"name": "needs-reproduction",
"color": "0052cc",
"description": "This issue needs reproduction steps or further work to reproduce"
},
{
"name": "no-pr-activity",
"color": "f7c6c7",
"description": "This pull request has not received recent activity"
}
]
steps:
- uses: actions/github-script@v7
with:
script: |
const labels = JSON.parse(process.env.LABELS);
for (const label of labels) {
try {
await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: label.name,
description: label.description || '',
color: label.color
});
} catch (error) {
if (error.status === 422) {
core.info(`Label "${label.name}" already exists`);
} else {
core.warning(`Failed to create label "${label.name}": ${error.message}`);
}
}
}
33 changes: 33 additions & 0 deletions .github/workflows/issue_regression_labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Apply potential regression label on issues
name: issue-regression-label
on:
issues:
types: [opened, edited]

jobs:
add-regression-label:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Fetch template body
id: check_regression
uses: actions/github-script@v7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TEMPLATE_BODY: ${{ github.event.issue.body }}
with:
script: |
const regressionPattern = /\[x\] Select this option if this issue appears to be a regression\./i;
const template = `${process.env.TEMPLATE_BODY}`
const match = regressionPattern.test(template);
core.setOutput('is_regression', match);
- name: Manage regression label
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ steps.check_regression.outputs.is_regression }}" == "true" ]; then
gh issue edit ${{ github.event.issue.number }} --add-label "potential-regression" -R ${{ github.repository }}
else
gh issue edit ${{ github.event.issue.number }} --remove-label "potential-regression" -R ${{ github.repository }}
fi

0 comments on commit 682f66a

Please sign in to comment.