|
30 | 30 | BASE_REPO: ${{ github.event.pull_request.base.repo.full_name }} |
31 | 31 | HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }} |
32 | 32 | run: | |
33 | | - echo "Token value: $GH_PR_VALIDATOR_TOKEN" |
34 | 33 | echo "base or target repo : ${{ github.event.pull_request.base.repo.full_name }}" |
35 | 34 | echo "head or source repo : ${{ github.event.pull_request.head.repo.full_name }}" |
36 | | - echo "$GH_PR_VALIDATOR_TOKEN" | gh auth login --with-token |
37 | 35 |
|
38 | 36 | if [[ ${{ github.event.pull_request.head.repo.full_name }} == ${{ github.event.pull_request.base.repo.full_name }} ]]; then |
39 | 37 | export forked=false |
|
46 | 44 | if [[ "$TITLE" =~ ^(doc:|docs:|chore:|misc:|Release:|release:|Sync:|sync:) ]]; then |
47 | 45 | echo "Skipping validation for docs/chore PR." |
48 | 46 | echo "PR NUMBER-: $PRNUM " |
49 | | - gh pr edit $PRNUM --remove-label "PR:Issue-verification-failed" |
50 | | - gh pr edit $PRNUM --add-label "PR:Ready-to-Review" |
| 47 | + if [[ "$forked" == "false" ]]; then |
| 48 | + gh pr edit $PRNUM --remove-label "PR:Issue-verification-failed" |
| 49 | + gh pr edit $PRNUM --add-label "PR:Ready-to-Review" |
| 50 | + else |
| 51 | + curl -L \ |
| 52 | + -X POST \ |
| 53 | + -H "Accept: application/vnd.github+json" \ |
| 54 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 55 | + https://api.github.com/repos/devtron-labs/${{ github.event.repository.name }}/issues/${{ github.event.pull_request.number }}/labels \ |
| 56 | + -d '{"labels":["PR:Ready-to-Review"]}' |
| 57 | +
|
| 58 | +
|
| 59 | +
|
| 60 | + curl -X DELETE \ |
| 61 | + -H "Accept: application/vnd.github+json" \ |
| 62 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 63 | + https://api.github.com/repos/devtron-labs/${{ github.event.repository.name }}/issues/${{ github.event.pull_request.number }}/labels/PR:Issue-verification-failed" |
| 64 | + fi |
51 | 65 | exit 0 |
52 | 66 | fi |
53 | 67 | |
@@ -111,7 +125,7 @@ jobs: |
111 | 125 | response=$(curl -s -w "%{http_code}" --header "Authorization: Bearer ${{ secrets.GH_PR_VALIDATOR_TOKEN }}" \ |
112 | 126 | --header "Accept: application/vnd.github+json" "$issue_api_url") |
113 | 127 | fi |
114 | | - |
| 128 | +{"labels":["PR:Ready-to-Review"]} |
115 | 129 | # Extract HTTP status code from the response |
116 | 130 | response_code=$(echo "$response" | tail -n 1) # Status code is the last line |
117 | 131 | response_body=$(echo "$response" | head -n -1) # The body is everything except the last line (status code) |
|
0 commit comments