Repository navigation
Commit c3dfa94
authored
fix(publish-preview-oidc): support dispatching previews by pull request or branch (#323)
* Let the preview workflows take a pull request number
NPM rejects trusted publishing tokens from `issue_comment` events, so the OIDC variant cannot publish when a comment triggers it. Add a `pull-request` input to `publish-preview-oidc.yml` and `prepare-preview.yml` so a `workflow_dispatch` caller can pass the number instead of relying on `github.event.issue.number`. In `prepare-preview.yml` the input is optional and falls back to the issue number, so `publish-preview.yml` keeps working unchanged.
React to the trigger comment only when there is one, and make `build-preview` depend on the fork check directly so it still runs when the reaction is skipped.
* Support previews from a branch and write a job summary
Add a `branch` input to `publish-preview-oidc.yml` and `prepare-preview.yml` as an alternative to `pull-request`, so a `workflow_dispatch` caller can publish a preview without a pull request. Exactly one of the two is required. The workflow validates the branch name with `git check-ref-format`, resolves it to a commit once, and checks out that commit, so a push during the run cannot change what gets built. Only branches in this repository are accepted. Other refs, such as `refs/pull/N/head` or raw SHAs, could point at fork code and bypass the fork check.
The preview build message is now always appended to `$GITHUB_STEP_SUMMARY`. The pull request comment is only posted when `pull-request` is set.1 parent b784ed2 commit c3dfa94
2 files changed
Lines changed: 76 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
22 | 31 | | |
23 | 32 | | |
24 | 33 | | |
| |||
42 | 51 | | |
43 | 52 | | |
44 | 53 | | |
| 54 | + | |
45 | 55 | | |
46 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
47 | 78 | | |
48 | 79 | | |
49 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
50 | 86 | | |
51 | 87 | | |
52 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
53 | 98 | | |
54 | 99 | | |
55 | 100 | | |
56 | 101 | | |
57 | | - | |
| 102 | + | |
58 | 103 | | |
59 | 104 | | |
60 | 105 | | |
| |||
69 | 114 | | |
70 | 115 | | |
71 | 116 | | |
72 | | - | |
| 117 | + | |
| 118 | + | |
73 | 119 | | |
74 | 120 | | |
75 | 121 | | |
76 | 122 | | |
77 | 123 | | |
| 124 | + | |
78 | 125 | | |
79 | 126 | | |
80 | 127 | | |
81 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
82 | 137 | | |
83 | 138 | | |
84 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
6 | 15 | | |
7 | 16 | | |
8 | 17 | | |
| |||
58 | 67 | | |
59 | 68 | | |
60 | 69 | | |
| 70 | + | |
| 71 | + | |
61 | 72 | | |
62 | 73 | | |
63 | 74 | | |
| |||
200 | 211 | | |
201 | 212 | | |
202 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
203 | 217 | | |
| 218 | + | |
204 | 219 | | |
205 | 220 | | |
206 | 221 | | |
207 | | - | |
| 222 | + | |
0 commit comments