free-programming-books/.github/workflows/stale.yml

134 lines
5.2 KiB
YAML
Raw Normal View History

name: Stale and close inactive issues/PRs
on:
schedule:
- cron: "0 0,6,12,18 * * *" # every 6 hours o'clock... 0:00am 6:00am 12:00pm 18:00pm
workflow_dispatch: # or manually
permissions:
2022-09-03 21:57:15 +00:00
contents: none
issues: read
pull-requests: read
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
2022-09-04 03:35:39 +00:00
group: '${{ github.workflow }} @ ${{ github.run_id }}'
cancel-in-progress: true
jobs:
process-issues:
name: Process Issues
2022-09-04 03:35:39 +00:00
# This allows a subsequently queued workflow run to wait for previous runs completion
concurrency:
group: '${{ github.workflow }} @ ${{ github.run_id }} :: issues'
cancel-in-progress: false
# export variables used by reporter job
2022-09-04 03:35:39 +00:00
outputs:
staled-issues: ${{ steps.staler.outputs.staled-issues-prs }}
closed-issues: ${{ steps.staler.outputs.closed-issues-prs }}
# enable write access rights to allow comment and labeling by bot
permissions:
issues: write
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 has been automatically marked as stale because it has not had activity during the last 60 days.
It will be closed if no further activity occurs on the next 30 days.
Thank you for your contributions.
close-issue-message: |
This issue has been automatically closed because it has been inactive during the last 30 days since being marked as stale.
Anyway, thank you for your contributions.
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
2022-09-04 03:35:39 +00:00
# This allows a subsequently queued workflow run to wait for previous runs completion
concurrency:
group: '${{ github.workflow }} @ ${{ github.run_id }} :: PRs'
cancel-in-progress: false
# export variables used by reporter job
2022-09-04 03:35:39 +00:00
outputs:
staled-prs: ${{ steps.staler.outputs.staled-issues-prs }}
closed-prs: ${{ steps.staler.outputs.closed-issues-prs }}
# enable write access rights to allow comment and labeling by bot
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 has been automatically marked as stale because it has not had activity during the last 60 days.
It will be closed if no further activity occurs on the next 30 days.
Thank you for your contributions.
close-pr-message: |
This pull request has been automatically closed because it has been inactive during the last 30 days since being marked as stale.
Anyway, thank you for your contributions.
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
reporter:
name: GitHub reporter
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 }}