Commit 4af395d
committed
Merge #7403: ci: hand built depends to source jobs via artifacts
7b8682d ci: hand freshly built depends to src jobs via artifact on PR runs (PastaClaw)
Pull request description:
## Summary
GitHub changed Actions cache behavior on June 26, 2026: untrusted triggers now receive read-only Actions cache tokens. See GitHub's changelog entry, ["Read-only Actions cache for untrusted triggers"](https://github.blog/changelog/2026-06-26-read-only-actions-cache-for-untrusted-triggers/).
For `pull_request_target` runs, a depends job can still build dependencies successfully, but `actions/cache/save` only warns when the token cannot reserve/write the cache. The later source-build jobs then fail if their depends cache restore misses.
This PR keeps `build.yml` least-privileged (`actions: read`) and adds a same-run handoff for freshly built depends trees:
- trusted runs still save and reuse the persistent Actions cache;
- `pull_request_target` runs skip the denied cache save path;
- fresh depends builds are uploaded as short-lived artifacts;
- source jobs first try the cache, then download the artifact on cache miss;
- source jobs fail only if both the cache and the artifact are unavailable.
## Why
The old workflow assumed that if a depends job built `depends/built/<host>`, the result could be saved to the Actions cache for downstream source jobs. That is no longer true for low-trust PR-triggered runs: restore may be allowed, while save is denied.
The previous attempted fix granted `actions: write` at the top level. That was reverted because the workflow checks out and executes PR-controlled code, and writable Actions scope is the wrong security model for `pull_request_target`.
## Implementation
- `.github/workflows/build-depends.yml`
- exposes a new `built-artifact` output;
- skips persistent cache save on `pull_request_target`;
- uploads `depends/built/<host>` as `depends-built-<target>` when a fresh build was needed.
- `.github/workflows/build-src.yml`
- adds an optional `depends-artifact` input;
- restores the persistent cache when present;
- downloads the built-depends artifact when the cache misses;
- errors only when there is no cache hit and no artifact to use.
- `.github/workflows/build.yml`
- forwards each depends job's `built-artifact` output to the matching source jobs;
- documents why the workflow stays at `actions: read`.
## Current CI caveat
The PR's own `pull_request_target` run cannot fully validate these reusable workflow changes yet, because GitHub runs reusable workflows from the base branch in this context. The current failing run shows source jobs using:
```text
dashpay/dash/.github/workflows/build-src.yml@refs/heads/develop
```
That means the red source jobs are still using `develop`'s old `fail-on-cache-miss: true` restore path, not this PR's artifact fallback.
## References
- [GitHub Changelog: Read-only Actions cache for untrusted triggers](https://github.blog/changelog/2026-06-26-read-only-actions-cache-for-untrusted-triggers/)
- [GitHub dependency caching reference](https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching)
- [actions/cache README](https://github.com/actions/cache)
## Test plan
- [ ] After merge, trigger or observe a `pull_request_target` run that needs a fresh depends build.
- [ ] Confirm depends jobs skip the denied persistent cache save on `pull_request_target`.
- [ ] Confirm those depends jobs upload `depends-built-<target>` artifacts.
- [ ] Confirm source jobs restore from cache when available.
- [ ] Confirm source jobs download the built-depends artifact when the cache misses.
- [ ] Confirm trusted `push` runs still save persistent depends caches.
ACKs for top commit:
UdjinM6:
utACK 7b8682d
Tree-SHA512: b1ebcf2f9be78297806a3350a764b9c3074afff560675fcbe6364ee7c7890e47f012c784ccee1e8c94a17404756bdad892195308fbfa9b8319c78fd134bdf15c3 files changed
Lines changed: 55 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
100 | 103 | | |
101 | 104 | | |
102 | 105 | | |
| 106 | + | |
| 107 | + | |
103 | 108 | | |
104 | 109 | | |
105 | 110 | | |
| |||
139 | 144 | | |
140 | 145 | | |
141 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
142 | 151 | | |
143 | 152 | | |
144 | 153 | | |
145 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
| |||
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
| 78 | + | |
73 | 79 | | |
74 | 80 | | |
75 | 81 | | |
76 | 82 | | |
77 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
78 | 101 | | |
79 | 102 | | |
80 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
| |||
215 | 216 | | |
216 | 217 | | |
217 | 218 | | |
| 219 | + | |
218 | 220 | | |
219 | 221 | | |
220 | 222 | | |
| |||
228 | 230 | | |
229 | 231 | | |
230 | 232 | | |
| 233 | + | |
231 | 234 | | |
232 | 235 | | |
233 | 236 | | |
| |||
241 | 244 | | |
242 | 245 | | |
243 | 246 | | |
| 247 | + | |
244 | 248 | | |
245 | 249 | | |
246 | 250 | | |
| |||
253 | 257 | | |
254 | 258 | | |
255 | 259 | | |
| 260 | + | |
256 | 261 | | |
257 | 262 | | |
258 | 263 | | |
| |||
266 | 271 | | |
267 | 272 | | |
268 | 273 | | |
| 274 | + | |
269 | 275 | | |
270 | 276 | | |
271 | 277 | | |
| |||
279 | 285 | | |
280 | 286 | | |
281 | 287 | | |
| 288 | + | |
282 | 289 | | |
283 | 290 | | |
284 | 291 | | |
| |||
292 | 299 | | |
293 | 300 | | |
294 | 301 | | |
| 302 | + | |
295 | 303 | | |
296 | 304 | | |
297 | 305 | | |
| |||
304 | 312 | | |
305 | 313 | | |
306 | 314 | | |
| 315 | + | |
307 | 316 | | |
308 | 317 | | |
309 | 318 | | |
| |||
316 | 325 | | |
317 | 326 | | |
318 | 327 | | |
| 328 | + | |
319 | 329 | | |
320 | 330 | | |
321 | 331 | | |
| |||
0 commit comments