|
| 1 | +name: Ping issue assignees |
| 2 | +# We have some specific pool of the issues we would like to handle. Sometimes |
| 3 | +# the issue from this pool has an assignee, but doesn't get any updates for a |
| 4 | +# long time. In this case it'd be useful to periodically ping the assignee. |
| 5 | + |
| 6 | +# Note: may be we could use "actions/stale@v*", but I'm not sure if it's |
| 7 | +# possible to not set the "stale" label at all. Even so, this action will not |
| 8 | +# ping the assignee of the "stale" issue more than onсe. |
| 9 | + |
| 10 | +# Note2: probably it'd be useful to have a small doc describing this "specific |
| 11 | +# pool" to refer to. |
| 12 | + |
| 13 | +on: |
| 14 | + schedule: |
| 15 | + - cron: '0 0 * * *' |
| 16 | + |
| 17 | +jobs: |
| 18 | + run: |
| 19 | + runs-on: ubuntu-20.04 |
| 20 | + env: |
| 21 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 22 | + REPO: ${{ github.repository }} |
| 23 | + steps: |
| 24 | + # List specific issues with an assignee but without recent updates. |
| 25 | + # Note: for some reason gh returns 0 results if the "assignee:*" filter is |
| 26 | + # added, so we have to manually filter the results. |
| 27 | + - name: Get the specicifc list of issues |
| 28 | + run: | |
| 29 | + gh issue list --search '-label:"help wanted" -label:cuda \ |
| 30 | + -label:confirmed -label:hip -label:sycl-mlir -label:upstream is:open \ |
| 31 | + -label:genx -label:sycl-bindless-images -label:sycl-graph \ |
| 32 | + -label:native-cpu' --limit 200 --json assignees --json number \ |
| 33 | + --json updatedAt \ |
| 34 | + -R https://github.com/${{ env.REPO }}.git > issues.json |
| 35 | +
|
| 36 | + - name: Filter issues and ping |
| 37 | + run: | |
| 38 | + days_to_stale=60 |
| 39 | + current_time=$(date +%s) |
| 40 | +
|
| 41 | + cat issues.json | jq -c '.[]' | while read -r issue; do |
| 42 | + assignees=$(echo "$issue" | jq '.assignees | length') |
| 43 | + [ "$assignees" -eq 0 ] && continue |
| 44 | +
|
| 45 | + updated_at=$(echo "$issue" | jq -r '.updatedAt') |
| 46 | + updated_at_seconds=$(date -d "$updated_at" +%s) |
| 47 | + difference_days=$(( (current_time - updated_at_seconds) / 86400 )) |
| 48 | + [ "$difference_days" -lt $days_to_stale ] && continue |
| 49 | +
|
| 50 | + issue_number=$(echo "$issue" | jq '.number') |
| 51 | + assignee_logins=$(echo "$issue" | jq -r '.assignees[].login' | sed 's/^/@/' | paste -s -d ' ' -) |
| 52 | + comment_body="Hi! There have been no updates for at least the last $days_to_stale days, though the issue has assignee(s). |
| 53 | +
|
| 54 | + $assignee_logins, could you please take one of the following actions: |
| 55 | + - provide an update if you have any |
| 56 | + - unassign yourself if you're not looking / going to look into this issue |
| 57 | + - mark this issue with the 'confirmed' label if you have confirmed the problem/request and our team should work on it |
| 58 | + - close the issue if it has been resolved |
| 59 | + - take any other suitable action. |
| 60 | +
|
| 61 | + Thanks!" |
| 62 | +
|
| 63 | + gh issue comment $issue_number -R https://github.com/${{ env.REPO }}.git -b "$comment_body" >> $GITHUB_STEP_SUMMARY |
| 64 | + done |
0 commit comments