@@ -9,19 +9,13 @@ description: Get the PR number without relying on the pull_request* event trigge
99runs :
1010 using : composite
1111 steps :
12- - name : Load branch name
13- id : get-branch
14- run : |
15- OLD_BRANCH=$(cat .github/BACKPORT_BRANCH)
16- echo "OLD_BRANCH=${OLD_BRANCH}" >> $GITHUB_ENV
17-
18- - name : Get PR info (PR branch)
19- if : ${{ github.ref_name != 'main' && github.ref_name != env.OLD_BRANCH }}
12+ - name : Get PR info (non-main branch)
13+ if : ${{ github.ref_name != 'main' }}
2014 uses : nv-gha-runners/get-pr-info@main
2115 id : get-pr-info
2216
23- - name : Extract PR number (PR branch)
24- if : ${{ github.ref_name != 'main' && github.ref_name != env.OLD_BRANCH }}
17+ - name : Extract PR number (non-main branch)
18+ if : ${{ github.ref_name != 'main' }}
2519 shell : bash --noprofile --norc -xeuo pipefail {0}
2620 run : |
2721 trap 'echo "Error at line $LINENO"; exit 1' ERR
3327 echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
3428 echo "BUILD_PREVIEW=1" >> $GITHUB_ENV
3529
36- - name : Get PR data (main/backport branch)
37- if : ${{ github.ref_name == 'main' || github.ref_name == env.OLD_BRANCH }}
30+ - name : Get PR data (main branch)
31+ if : ${{ github.ref_name == 'main' }}
3832 uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
3933 id : get-pr-data
4034 with :
@@ -45,19 +39,19 @@ runs:
4539 repo: context.repo.repo,
4640 });
4741 if (!prs.data.length) {
48- core.setFailed("No PR associated with this commit on ${{ github.ref_name }} .");
42+ core.setFailed("No PR associated with this commit on 'main' .");
4943 } else {
5044 return prs.data[0];
5145 }
5246
53- - name : Extract PR number (main/backport branch)
54- if : ${{ github.ref_name == 'main' || github.ref_name == env.OLD_BRANCH }}
47+ - name : Extract PR number (main branch)
48+ if : ${{ github.ref_name == 'main' }}
5549 shell : bash --noprofile --norc -xeuo pipefail {0}
5650 run : |
5751 trap 'echo "Error at line $LINENO"; exit 1' ERR
5852 PR_NUMBER="${{ fromJSON(steps.get-pr-data.outputs.result).number }}"
5953 if [[ -z "$PR_NUMBER" ]]; then
60- echo "No associated PR found for the commit in ${{ github.ref_name }} ."
54+ echo "No associated PR found for the commit in 'main' ."
6155 exit 1
6256 fi
6357 echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
0 commit comments