forked from NVIDIA/cuda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
71 lines (64 loc) · 3.34 KB
/
action.yml
File metadata and controls
71 lines (64 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
name: Docs in PRs
description: Preview or clean up docs built from PRs
# A re-implementation based on the logic of https://github.com/rossjrw/pr-preview-action/blob/41a957c44a456a34718e9bcf825363194db5e6d5/README.md, due to limitations illustrated in NVIDIA/cuda-python#380.
inputs:
source-folder:
required: true
description: "Source code directory"
pr-number:
required: true
description: "Pull request number"
runs:
using: composite
steps:
# The steps below are executed only when testing in a PR.
# Note: the PR previews will be removed once merged to main or release/* (see below)
- name: Deploy doc preview
if: ${{ github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
with:
git-config-name: cuda-python-bot
git-config-email: cuda-python-bot@users.noreply.github.com
folder: ${{ inputs.source-folder }}
target-folder: docs/pr-preview/pr-${{ inputs.pr-number }}/
commit-message: "Deploy doc preview for PR ${{ inputs.pr-number }} (${{ github.sha }})"
- name: Leave a comment after deployment
if: ${{ github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
uses: marocchino/sticky-pull-request-comment@d4d6b0936434b21bc8345ad45a440c5f7d2c40ff # v3.0.3
with:
header: pr-preview
number: ${{ inputs.pr-number }}
skip_unchanged: true
message: |
Doc Preview CI
:---:
| <p></p> :rocket: View preview at <br> https://nvidia.github.io/cuda-python/pr-preview/pr-${{ inputs.pr-number }}/ <br>
| <br> https://nvidia.github.io/cuda-python/pr-preview/pr-${{ inputs.pr-number }}/cuda-core/ <br>
| <br> https://nvidia.github.io/cuda-python/pr-preview/pr-${{ inputs.pr-number }}/cuda-bindings/ <br>
| <br> https://nvidia.github.io/cuda-python/pr-preview/pr-${{ inputs.pr-number }}/cuda-pathfinder/ <br><br>
| <h6><br> Preview will be ready when the GitHub Pages deployment is complete. <br><br></h6>
# The steps below are executed only when building on main or release/*.
- name: Remove doc preview
if: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release/') }}
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
with:
git-config-name: cuda-python-bot
git-config-email: cuda-python-bot@users.noreply.github.com
folder: ${{ inputs.source-folder }}
target-folder: docs/pr-preview/pr-${{ inputs.pr-number }}/
commit-message: "Clean up doc preview for PR ${{ inputs.pr-number }} (${{ github.sha }})"
- name: Leave a comment after removal
if: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release/') }}
uses: marocchino/sticky-pull-request-comment@d4d6b0936434b21bc8345ad45a440c5f7d2c40ff # v3.0.3
with:
header: pr-preview
number: ${{ inputs.pr-number }}
hide_and_recreate: true
hide_classify: "OUTDATED"
message: |
Doc Preview CI
:---:
Preview removed because the pull request was closed or merged.