Skip to content

Commit 3c307b4

Browse files
authored
[cuda.core v0.4.2] Ensure custom actions can run on the release/* branches (#1261)
* relax to allow release/* branches in get_pr_number * relax to allow release/* branches in doc_preview
1 parent 47e6c8c commit 3c307b4

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

.github/actions/doc_preview/action.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ runs:
2121
using: composite
2222
steps:
2323
# The steps below are executed only when testing in a PR.
24-
# Note: the PR previews will be removed once merged to main (see below)
24+
# Note: the PR previews will be removed once merged to main or release/* (see below)
2525
- name: Deploy doc preview
26-
if: ${{ github.ref_name != 'main' }}
26+
if: ${{ github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
2727
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # v4.7.3
2828
with:
2929
git-config-name: cuda-python-bot
@@ -33,7 +33,7 @@ runs:
3333
commit-message: "Deploy doc preview for PR ${{ inputs.pr-number }} (${{ github.sha }})"
3434

3535
- name: Leave a comment after deployment
36-
if: ${{ github.ref_name != 'main' }}
36+
if: ${{ github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
3737
uses: marocchino/sticky-pull-request-comment@67d0dec7b07ed060a405f9b2a64b8ab319fdd7db # v2.9.2
3838
with:
3939
header: pr-preview
@@ -48,9 +48,9 @@ runs:
4848
| <br> https://nvidia.github.io/cuda-python/pr-preview/pr-${{ inputs.pr-number }}/cuda-pathfinder/ <br><br>
4949
| <h6><br> Preview will be ready when the GitHub Pages deployment is complete. <br><br></h6>
5050
51-
# The steps below are executed only when building on main.
51+
# The steps below are executed only when building on main or release/*.
5252
- name: Remove doc preview
53-
if: ${{ github.ref_name == 'main' }}
53+
if: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release/') }}
5454
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # v4.7.3
5555
with:
5656
git-config-name: cuda-python-bot
@@ -60,7 +60,7 @@ runs:
6060
commit-message: "Clean up doc preview for PR ${{ inputs.pr-number }} (${{ github.sha }})"
6161

6262
- name: Leave a comment after removal
63-
if: ${{ github.ref_name == 'main' }}
63+
if: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release/') }}
6464
uses: marocchino/sticky-pull-request-comment@67d0dec7b07ed060a405f9b2a64b8ab319fdd7db # v2.9.2
6565
with:
6666
header: pr-preview

.github/actions/get_pr_number/action.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ description: Get the PR number without relying on the pull_request* event trigge
99
runs:
1010
using: composite
1111
steps:
12-
- name: Get PR info (non-main branch)
13-
if: ${{ github.ref_name != 'main' }}
12+
- name: Get PR info (non-main, non-release branch)
13+
if: ${{ github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
1414
uses: nv-gha-runners/get-pr-info@main
1515
id: get-pr-info
1616

17-
- name: Extract PR number (non-main branch)
18-
if: ${{ github.ref_name != 'main' }}
17+
- name: Extract PR number (non-main, non-release branch)
18+
if: ${{ github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
1919
shell: bash --noprofile --norc -xeuo pipefail {0}
2020
run: |
2121
trap 'echo "Error at line $LINENO"; exit 1' ERR
@@ -27,8 +27,8 @@ runs:
2727
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
2828
echo "BUILD_PREVIEW=1" >> $GITHUB_ENV
2929
30-
- name: Get PR data (main branch)
31-
if: ${{ github.ref_name == 'main' }}
30+
- name: Get PR data (main or release/* branch)
31+
if: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release/') }}
3232
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
3333
id: get-pr-data
3434
with:
@@ -39,19 +39,19 @@ runs:
3939
repo: context.repo.repo,
4040
});
4141
if (!prs.data.length) {
42-
core.setFailed("No PR associated with this commit on 'main'.");
42+
core.setFailed("No PR associated with this commit on 'main' or 'release/*'.");
4343
} else {
4444
return prs.data[0];
4545
}
4646
47-
- name: Extract PR number (main branch)
48-
if: ${{ github.ref_name == 'main' }}
47+
- name: Extract PR number (main or release/* branch)
48+
if: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release/') }}
4949
shell: bash --noprofile --norc -xeuo pipefail {0}
5050
run: |
5151
trap 'echo "Error at line $LINENO"; exit 1' ERR
5252
PR_NUMBER="${{ fromJSON(steps.get-pr-data.outputs.result).number }}"
5353
if [[ -z "$PR_NUMBER" ]]; then
54-
echo "No associated PR found for the commit in 'main'."
54+
echo "No associated PR found for the commit in 'main' or 'release/*'."
5555
exit 1
5656
fi
5757
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV

0 commit comments

Comments
 (0)