Skip to content

Commit 5149ebd

Browse files
committed
internal/ci: use pull_request_target for PR CI jobs
So that they can have access to secrets.NOTCUECKOO_CUE_TOKEN, as otherwise we fail to fetch dependencies from the central registry. https://github.com/cue-lang/cue/wiki/Notes-for-project-maintainers is also updated with a brief mention of reviewing the changes before triggering a CI job on a GitHub PR. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I9fdd861c09f7b2a81e09be22f93db70a4b537ed4 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1205188 Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Paul Jolly <[email protected]>
1 parent 432c114 commit 5149ebd

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

.github/workflows/trybot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ name: TryBot
1010
tags-ignore:
1111
- v*
1212
workflow_dispatch: {}
13-
pull_request: {}
13+
pull_request_target: {}
1414
jobs:
1515
test:
1616
strategy:

internal/ci/base/github.cue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ checkoutCode: {
6767
name: "Checkout code"
6868
uses: "actions/checkout@v4"
6969

70-
// "pull_request" builds will by default use a merge commit,
70+
// "pull_request_target" builds will by default use a merge commit,
7171
// testing the PR's HEAD merged on top of the master branch.
7272
// For consistency with Gerrit, avoid that merge commit entirely.
7373
// This doesn't affect builds by other events like "push",

internal/ci/github/trybot.cue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ workflows: trybot: _repo.bashWorkflow & {
2929
branches: list.Concat([[_repo.testDefaultBranch], _repo.protectedBranchPatterns]) // do not run PR branches
3030
"tags-ignore": [_repo.releaseTagPattern]
3131
}
32-
pull_request: {}
32+
// Note that pull_request_target gives PR CI jobs full access to our secrets,
33+
// which is necessary to fetch dependencies from the registry via NOTCUECKOO_CUE_TOKEN.
34+
// Giving access to secrets is OK given that we must approve PR jobs to run on CI,
35+
// which mirrors the approval workflow for CI on Gerrit.
36+
pull_request_target: {}
3337
}
3438

3539
jobs: {

0 commit comments

Comments
 (0)