solidity/.github/workflows/stale-issues.yml
2022-11-26 01:40:56 +01:00

47 lines
1.4 KiB
YAML

name: Ping and close stale issues
on:
workflow_dispatch: # FIXME: remove
schedule:
- cron: '0 12 * * *'
env:
INACTIVITY_PERIOD: 14 # in days
WAIT_FOR_INFO_LABEL: "waiting for more input"
DRY_RUN: true
jobs:
check-issue-status:
name: Retrieve all open issues that are inactive
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get inactive open issues
id: stale_issues
uses: ./.github/actions/stale_issues
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
inactivity_period: ${{ env.INACTIVITY_PERIOD }}
- name: Comment on found issues
if: ${{ success() }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for issue_url in ${{ steps.stale_issues.outputs.result }}; do
# Filter stale issues that were triaged and are not waiting for more information
is_stale=$(
gh issue view $issue_url \
--json labels \
--jq '.labels | map(.name != "$WAIT_FOR_INFO_LABEL") | all and length > 0'
)
if [[ $is_stale == 'true' ]]; then
if [[ $DRY_RUN == 'true' ]]; then
echo "Commenting on issue: $issue_url"
else
gh issue comment $issue_url --body "Hey, devs! I have been waiting for too long. Please give me some attention! :-)"
fi
fi
done