@@ -6,97 +6,57 @@ inputs:
6
6
source-folder :
7
7
required : true
8
8
type : string
9
+ pr-number :
10
+ required : true
11
+ type : string
9
12
10
13
runs :
11
14
using : composite
12
15
steps :
13
16
# 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)
32
18
- name : Deploy doc preview
33
19
if : ${{ github.ref_name != 'main' }}
34
20
uses : JamesIves/github-pages-deploy-action@v4
35
21
with :
36
22
git-config-name : cuda-python-bot
37
23
git-config-email :
[email protected]
38
24
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 }})"
41
27
42
28
- name : Leave a comment after deployment
43
29
if : ${{ github.ref_name != 'main' }}
44
30
uses : marocchino/sticky-pull-request-comment@v2
45
31
with :
46
32
header : pr-preview
47
- number : ${{ env.PR_NUMBER }}
33
+ number : ${{ inputs.pr-number }}
48
34
skip_unchanged : true
49
35
message : |
50
36
Doc Preview CI
51
37
:---:
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>
55
41
| <h6><br> Preview will be ready when the GitHub Pages deployment is complete. <br><br></h6>
56
42
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.
84
44
- name : Remove doc preview
85
45
if : ${{ github.ref_name == 'main' }}
86
46
uses : JamesIves/github-pages-deploy-action@v4
87
47
with :
88
48
git-config-name : cuda-python-bot
89
49
git-config-email :
[email protected]
90
50
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 }})"
93
53
94
54
- name : Leave a comment after removal
95
55
if : ${{ github.ref_name == 'main' }}
96
56
uses : marocchino/sticky-pull-request-comment@v2
97
57
with :
98
58
header : pr-preview
99
- number : ${{ env.PR_NUMBER }}
59
+ number : ${{ inputs.pr-number }}
100
60
hide_and_recreate : true
101
61
hide_classify : " OUTDATED"
102
62
message : |
0 commit comments