@@ -6,97 +6,57 @@ inputs:
66 source-folder :
77 required : true
88 type : string
9+ pr-number :
10+ required : true
11+ type : string
912
1013runs :
1114 using : composite
1215 steps :
1316 # The steps below are executed only when testing in a PR.
14- # Note: the PR previews will be removed once merged to main (see below)
15- - name : Get PR info
16- if : ${{ github.ref_name != 'main' }}
17- uses : nv-gha-runners/get-pr-info@main
18- id : get-pr-info
19-
20- - name : Extract PR number from info
21- if : ${{ github.ref_name != 'main' }}
22- shell : bash --noprofile --norc -xeuo pipefail {0}
23- run : |
24- PR_NUMBER="${{ fromJSON(steps.get-pr-info.outputs.pr-info).number }}"
25- if [[ "$PR_NUMBER" == "" ]]; then
26- echo "cannot extract PR number"
27- exit 1
28- else
29- echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
30- fi
31-
17+ # Note: the PR previews will be removed once merged to main (see below)
3218 - name : Deploy doc preview
3319 if : ${{ github.ref_name != 'main' }}
3420 uses : JamesIves/github-pages-deploy-action@v4
3521 with :
3622 git-config-name : cuda-python-bot
3723 git-config-email : cuda-python-bot@users.noreply.github.com
3824 folder : ${{ inputs.source-folder }}
39- target-folder : docs/pr-preview/pr-${{ env.PR_NUMBER }}/
40- commit-message : " Deploy doc preview for PR ${{ env.PR_NUMBER }} (${{ github.sha }})"
25+ target-folder : docs/pr-preview/pr-${{ inputs.pr-number }}/
26+ commit-message : " Deploy doc preview for PR ${{ inputs.pr-number }} (${{ github.sha }})"
4127
4228 - name : Leave a comment after deployment
4329 if : ${{ github.ref_name != 'main' }}
4430 uses : marocchino/sticky-pull-request-comment@v2
4531 with :
4632 header : pr-preview
47- number : ${{ env.PR_NUMBER }}
33+ number : ${{ inputs.pr-number }}
4834 skip_unchanged : true
4935 message : |
5036 Doc Preview CI
5137 :---:
52- | <p></p> :rocket: View preview at <br> https://nvidia.github.io/cuda-python/pr-preview/pr-${{ env.PR_NUMBER }}/ <br>
53- | <br> https://nvidia.github.io/cuda-python/pr-preview/pr-${{ env.PR_NUMBER }}/cuda-core/ <br>
54- | <br> https://nvidia.github.io/cuda-python/pr-preview/pr-${{ env.PR_NUMBER }}/cuda-bindings/ <br><br>
38+ | <p></p> :rocket: View preview at <br> https://nvidia.github.io/cuda-python/pr-preview/pr-${{ inputs.pr-number }}/ <br>
39+ | <br> https://nvidia.github.io/cuda-python/pr-preview/pr-${{ inputs.pr-number }}/cuda-core/ <br>
40+ | <br> https://nvidia.github.io/cuda-python/pr-preview/pr-${{ inputs.pr-number }}/cuda-bindings/ <br><br>
5541 | <h6><br> Preview will be ready when the GitHub Pages deployment is complete. <br><br></h6>
5642
57- # The steps below are executed only when building on main.
58- - name : Get PR data
59- if : ${{ github.ref_name == 'main' }}
60- uses : actions/github-script@v7
61- id : get-pr-data
62- with :
63- script : |
64- return (
65- await github.rest.repos.listPullRequestsAssociatedWithCommit({
66- commit_sha: context.sha,
67- owner: context.repo.owner,
68- repo: context.repo.repo,
69- })
70- ).data[0];
71-
72- - name : Extract PR number from data
73- if : ${{ github.ref_name == 'main' }}
74- shell : bash --noprofile --norc -xeuo pipefail {0}
75- run : |
76- PR_NUMBER="${{ fromJSON(steps.get-pr-data.outputs.result).number }}"
77- if [[ "$PR_NUMBER" == "" ]]; then
78- echo "cannot extract PR number"
79- exit 1
80- else
81- echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
82- fi
83-
43+ # The steps below are executed only when building on main.
8444 - name : Remove doc preview
8545 if : ${{ github.ref_name == 'main' }}
8646 uses : JamesIves/github-pages-deploy-action@v4
8747 with :
8848 git-config-name : cuda-python-bot
8949 git-config-email : cuda-python-bot@users.noreply.github.com
9050 folder : ${{ inputs.source-folder }}
91- target-folder : docs/pr-preview/pr-${{ env.PR_NUMBER }}/
92- commit-message : " Clean up doc preview for PR ${{ env.PR_NUMBER }} (${{ github.sha }})"
51+ target-folder : docs/pr-preview/pr-${{ inputs.pr-number }}/
52+ commit-message : " Clean up doc preview for PR ${{ inputs.pr-number }} (${{ github.sha }})"
9353
9454 - name : Leave a comment after removal
9555 if : ${{ github.ref_name == 'main' }}
9656 uses : marocchino/sticky-pull-request-comment@v2
9757 with :
9858 header : pr-preview
99- number : ${{ env.PR_NUMBER }}
59+ number : ${{ inputs.pr-number }}
10060 hide_and_recreate : true
10161 hide_classify : " OUTDATED"
10262 message : |
0 commit comments