Skip to content

Commit 19fe354

Browse files
committed
tools: retry first-time contributor query
Retry unresolved author associations with exponential backoff so GitHub has time to populate first-time contributor status. Log the elapsed time for each query to show when the status becomes available. Signed-off-by: Filip Skokan <panva.ip@gmail.com>
1 parent 045ff95 commit 19fe354

1 file changed

Lines changed: 22 additions & 11 deletions

File tree

.github/workflows/first-time-contributor.yml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,29 @@ jobs:
3333
GH_TOKEN: ${{ github.token }}
3434
NUMBER: ${{ github.event.pull_request.number }}
3535
run: |
36-
association=$(gh api "/repos/$GITHUB_REPOSITORY/pulls/$NUMBER" \
37-
--jq '.author_association')
38-
echo "Author association: $association"
36+
started_at=$SECONDS
37+
for delay in 15 30 60 120; do
38+
sleep "$delay"
39+
association=$(gh api "/repos/$GITHUB_REPOSITORY/pulls/$NUMBER" \
40+
--jq '.author_association')
41+
elapsed=$((SECONDS - started_at))
42+
echo "Author association after ${elapsed}s: $association"
3943
40-
case "$association" in
41-
FIRST_TIMER|FIRST_TIME_CONTRIBUTOR)
42-
echo 'eligible=true' >> "$GITHUB_OUTPUT"
43-
;;
44-
*)
45-
echo 'eligible=false' >> "$GITHUB_OUTPUT"
46-
;;
47-
esac
44+
case "$association" in
45+
FIRST_TIMER|FIRST_TIME_CONTRIBUTOR)
46+
echo 'eligible=true' >> "$GITHUB_OUTPUT"
47+
exit 0
48+
;;
49+
NONE)
50+
;;
51+
*)
52+
echo 'eligible=false' >> "$GITHUB_OUTPUT"
53+
exit 0
54+
;;
55+
esac
56+
done
57+
58+
echo 'eligible=false' >> "$GITHUB_OUTPUT"
4859
4960
agentscan:
5061
needs: first_time_contributor

0 commit comments

Comments
 (0)