mirror of
https://github.com/EbookFoundation/free-programming-books.git
synced 2025-01-19 17:08:52 +00:00
106 lines
3.7 KiB
YAML
106 lines
3.7 KiB
YAML
|
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
|
||
|
|
||
|
runs-on: ubuntu-latest
|
||
|
|
||
|
steps:
|
||
|
- uses: actions/stale@v5
|
||
|
with:
|
||
|
operations-per-run: 30
|
||
|
days-before-issue-stale: 30
|
||
|
days-before-issue-close: 7
|
||
|
stale-issue-label: "stale"
|
||
|
close-issue-label: "stale: closed"
|
||
|
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
|
||
|
close-issue-message: "This issue was closed because it has been inactive for 7 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: 30
|
||
|
days-before-pr-close: 7
|
||
|
stale-pr-label: "stale"
|
||
|
close-pr-label: "stale: closed"
|
||
|
stale-pr-message: "This pull request is stale because it has been open for 30 days with no activity."
|
||
|
close-pr-message: "This pull request was closed because it has been inactive for 7 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 }}
|