File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 1111 runs-on : ubuntu-latest
1212 permissions :
1313 pull-requests : write
14+ contents : read
1415 steps :
1516 - name : Check if the PR creator is the repo owner or Weblate
1617 id : check_owner
@@ -21,12 +22,27 @@ jobs:
2122 echo "The PR creator is the repository owner or Weblate. Skipping greeting message."
2223 echo "skip=true" >> $GITHUB_ENV
2324 else
24- echo "The PR creator is not the repository owner or Weblate. Sending greeting message ."
25+ echo "The PR creator is not the repository owner or Weblate. Proceeding to check contribution history ."
2526 echo "skip=false" >> $GITHUB_ENV
2627 fi
2728
28- - name : Send Greeting Message
29+ - name : Check if the contributor is first-time
30+ id : check_first_time
2931 if : env.skip != 'true'
32+ run : |
33+ PR_AUTHOR=$(jq -r '.pull_request.user.login' "$GITHUB_EVENT_PATH")
34+ CONTRIBUTOR_CHECK=$(curl -s "https://api.github.com/repos/${GITHUB_REPOSITORY}/commits?author=${PR_AUTHOR}&per_page=100" | jq -r '.[].commit.author.name')
35+
36+ if [[ -z "$CONTRIBUTOR_CHECK" ]]; then
37+ echo "This is a first-time contributor. Sending greeting message."
38+ echo "first_time=true" >> $GITHUB_ENV
39+ else
40+ echo "This contributor has contributed before. Skipping greeting message."
41+ echo "first_time=false" >> $GITHUB_ENV
42+ fi
43+
44+ - name : Send Greeting Message
45+ if : env.first_time == 'true'
3046 uses : actions/github-script@v6
3147 with :
3248 script : |
You can’t perform that action at this time.
0 commit comments