-
Notifications
You must be signed in to change notification settings - Fork 277
53 lines (49 loc) · 2.03 KB
/
Copy pathrecheck-cla.yml
File metadata and controls
53 lines (49 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Recheck CLA
on:
issue_comment:
types: [created]
jobs:
recheck-cla:
name: Recheck CLA
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/recheck-cla')
runs-on: ubuntu-latest
steps:
- name: Get PR number
id: pr_number
run: echo "PR_NUMBER=${{ github.event.issue.number }}" >> $GITHUB_OUTPUT
- name: Trigger CLA check
id: trigger
run: |
set -e
RESPONSE=$(curl -L -f -s -w "\n%{http_code}" --retry 3 --retry-delay 2 \
-X GET "https://cla-assistant.io/check/${{ github.repository_owner }}/${{ github.event.repository.name }}?pullRequest=${{ steps.pr_number.outputs.PR_NUMBER }}")
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | head -n -1)
echo "HTTP status: $HTTP_CODE"
echo "Response body: $BODY"
if [[ "$HTTP_CODE" -ge 200 && "$HTTP_CODE" -lt 300 ]]; then
echo "success=true" >> $GITHUB_OUTPUT
else
echo "success=false" >> $GITHUB_OUTPUT
echo "CLA assistant returned HTTP $HTTP_CODE" >> $GITHUB_OUTPUT
exit 1
fi
- name: Comment result on PR
if: ${{ always() && ! contains(github.event.comment.body, 'Instructions') }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const success = '${{ steps.trigger.outputs.success }}' === 'true';
let body = '';
if (success) {
body = '✅ CLA recheck triggered. The status should update shortly.';
} else {
body = '⚠️ Failed to trigger CLA recheck. Please try again later. If the problem persists, check the [CLA Assistant status](https://cla-assistant.io/).';
}
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
});