Skip to content

Commit be0601b

Browse files
committed
internal/ci: improve push_tip_to_trybot defaults
Every parameter to this workflow is itself ultimately a value that can be derived from the base package parameters. So push the values down. Whilst we are here, get rid of the separate files for the push_tip_to_trybot and trybot_dispatch workflows in the github package. These are one-liners more easily covered in the workflows.cue file. Also switch to using bashWorkflow in a couple of places instead of reinventing the wheel. Signed-off-by: Paul Jolly <paul@myitcv.io> Change-Id: I0b97fe027452c9b2185858ac2e099fad636dcae8 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/551830 Unity-Result: CUEcueckoo <cueckoo@cuelang.org> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
1 parent 646e965 commit be0601b

File tree

5 files changed

+14
-52
lines changed

5 files changed

+14
-52
lines changed

.github/workflows/push_tip_to_trybot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
defaults:
1414
run:
1515
shell: bash
16+
if: ${{github.repository == 'cue-lang/cue'}}
1617
steps:
1718
- name: Write netrc file for cueckoo Gerrithub
1819
run: |-
@@ -47,4 +48,3 @@ jobs:
4748
echo "Giving up"
4849
exit 1
4950
fi
50-
if: ${{github.repository == 'cue-lang/cue'}}

internal/ci/base/gerrithub.cue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/SchemaStore/schemastore/src/schemas/json"
77
)
88

9-
trybotDispatchWorkflow: json.#Workflow & {
9+
trybotDispatchWorkflow: bashWorkflow & {
1010
_#branchNameExpression: "\(trybot.key)/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }}/${{ steps.gerrithub_ref.outputs.gerrithub_ref }}"
1111
name: "Dispatch \(trybot.key)"
1212
on: ["repository_dispatch"]
@@ -50,9 +50,17 @@ trybotDispatchWorkflow: json.#Workflow & {
5050
}
5151
}
5252

53-
pushTipToTrybotWorkflow: json.#Workflow & {
53+
pushTipToTrybotWorkflow: bashWorkflow & {
5454
jobs: [string]: defaults: run: shell: "bash"
5555

56+
on: {
57+
push: branches: protectedBranchPatterns
58+
}
59+
jobs: push: {
60+
"runs-on": linuxMachine
61+
if: "${{github.repository == '\(githubRepositoryPath)'}}"
62+
}
63+
5664
name: "Push tip to \(trybot.key)"
5765

5866
concurrency: "push_tip_to_trybot"

internal/ci/github/push_tip_to_trybot.cue

Lines changed: 0 additions & 28 deletions
This file was deleted.

internal/ci/github/trybot_dispatch.cue

Lines changed: 0 additions & 18 deletions
This file was deleted.

internal/ci/github/workflows.cue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ import (
4040
workflows: close({
4141
[string]: json.#Workflow
4242

43-
(_repo.trybot.key): _
44-
trybot_dispatch: _
43+
(_repo.trybot.key): _
44+
trybot_dispatch: _repo.trybotDispatchWorkflow
4545
release: _
4646
tip_triggers: _
47-
push_tip_to_trybot: _
47+
push_tip_to_trybot: _repo.pushTipToTrybotWorkflow
4848
evict_caches: _
4949
})

0 commit comments

Comments
 (0)