Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(stale): create stale.yml workflow #7053

Merged
merged 15 commits into from Sep 13, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
105 changes: 105 additions & 0 deletions .github/workflows/stale.yml
@@ -0,0 +1,105 @@
name: Stale and close inactive issues/PRs

on:
schedule:
- cron: "30 1 * * *" # each day at 1:30AM
workflow_dispatch: # or manually

permissions:
issues: read
pull-requests: read

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref || github.run_id }}'
cancel-in-progress: true

jobs:

process-issues:
name: Process Issues

permissions:
issues: write
davorpa marked this conversation as resolved.
Show resolved Hide resolved

runs-on: ubuntu-latest

steps:
- uses: actions/stale@v5
with:
operations-per-run: 30
days-before-issue-stale: 60
days-before-issue-close: 30
stale-issue-label: "stale"
close-issue-label: "stale: closed"
stale-issue-message: "This issue is stale because it has been open for 60 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 30 days since being marked as stale."
remove-issue-stale-when-updated: true
exempt-issue-labels: "👥 discussion,👀 Needs Review,📌 pinned"
days-before-pr-stale: -1
days-before-pr-close: -1

process-prs:
name: Process Pull Requests

permissions:
pull-requests: write

runs-on: ubuntu-latest

steps:
- uses: actions/stale@v5
with:
operations-per-run: 30
days-before-pr-stale: 60
days-before-pr-close: 30
stale-pr-label: "stale"
close-pr-label: "stale: closed"
stale-pr-message: "This pull request is stale because it has been open for 60 days with no activity."
close-pr-message: "This pull request was closed because it has been inactive for 30 days since being marked as stale."
remove-pr-stale-when-updated: true
exempt-pr-labels: "👥 discussion,👀 Needs Review"
exempt-draft-pr: true
days-before-issue-stale: -1
days-before-issue-close: -1

generate-summary:
name: GitHub report

needs: [process-issues, process-prs]

runs-on: ubuntu-latest

steps:
- run: |
echo "### Staled issues" \
>> $GITHUB_STEP_SUMMARY
echo "$STALED_ISSUES" \
| jq --raw-output 'map("* [#\(.number)](\(env.GITHUB_ISSUES_URL)/\(.number)): \(.title)") | join("\n")' \
>> $GITHUB_STEP_SUMMARY

echo "### Staled pull requests" \
>> $GITHUB_STEP_SUMMARY
echo "$STALED_PRS" \
| jq --raw-output 'map("* [#\(.number)](\(env.GITHUB_PULL_URL)/\(.number)): \(.title)") | join("\n")' \
>> $GITHUB_STEP_SUMMARY

echo "### Closed issues" \
>> $GITHUB_STEP_SUMMARY
echo "$CLOSED_ISSUES" \
| jq --raw-output 'map("* [#\(.number)](\(env.GITHUB_ISSUES_URL)/\(.number)): \(.title)") | join("\n")' \
>> $GITHUB_STEP_SUMMARY

echo "### Closed pull requests" \
>> $GITHUB_STEP_SUMMARY
echo "$CLOSED_PRS" \
| jq --raw-output 'map("* [#\(.number)](\(env.GITHUB_PULL_URL)/\(.number)): \(.title)") | join("\n")' \
>> $GITHUB_STEP_SUMMARY
env:
GITHUB_REPO_URL: ${{ format('{0}/{1}', github.server_url, github.repository) }}
GITHUB_ISSUES_URL: ${{ format('{0}/{1}/issues', github.server_url, github.repository) }}
GITHUB_PULL_URL: ${{ format('{0}/{1}/pull', github.server_url, github.repository) }}
STALED_ISSUES: ${{ needs.process-issues.outputs.staled-issues-prs }}
CLOSED_ISSUES: ${{ needs.process-issues.outputs.closed-issues-prs }}
STALED_PRS: ${{ needs.process-prs.outputs.staled-issues-prs }}
CLOSED_PRS: ${{ needs.process-prs.outputs.closed-issues-prs }}