diff --git a/.github/workflows/push_tip_to_trybot.yml b/.github/workflows/push_tip_to_trybot.yml index 0042bb302c9..0dba7d936e1 100644 --- a/.github/workflows/push_tip_to_trybot.yml +++ b/.github/workflows/push_tip_to_trybot.yml @@ -13,6 +13,7 @@ jobs: defaults: run: shell: bash + if: ${{github.repository == 'cue-lang/cue'}} steps: - name: Write netrc file for cueckoo Gerrithub run: |- @@ -47,4 +48,3 @@ jobs: echo "Giving up" exit 1 fi - if: ${{github.repository == 'cue-lang/cue'}} diff --git a/internal/ci/base/gerrithub.cue b/internal/ci/base/gerrithub.cue index c18d01c8a82..37727a0a47e 100644 --- a/internal/ci/base/gerrithub.cue +++ b/internal/ci/base/gerrithub.cue @@ -6,7 +6,7 @@ import ( "github.com/SchemaStore/schemastore/src/schemas/json" ) -trybotDispatchWorkflow: json.#Workflow & { +trybotDispatchWorkflow: bashWorkflow & { _#branchNameExpression: "\(trybot.key)/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }}/${{ steps.gerrithub_ref.outputs.gerrithub_ref }}" name: "Dispatch \(trybot.key)" on: ["repository_dispatch"] @@ -50,9 +50,17 @@ trybotDispatchWorkflow: json.#Workflow & { } } -pushTipToTrybotWorkflow: json.#Workflow & { +pushTipToTrybotWorkflow: bashWorkflow & { jobs: [string]: defaults: run: shell: "bash" + on: { + push: branches: protectedBranchPatterns + } + jobs: push: { + "runs-on": linuxMachine + if: "${{github.repository == '\(githubRepositoryPath)'}}" + } + name: "Push tip to \(trybot.key)" concurrency: "push_tip_to_trybot" diff --git a/internal/ci/github/push_tip_to_trybot.cue b/internal/ci/github/push_tip_to_trybot.cue deleted file mode 100644 index 3773ed65dd5..00000000000 --- a/internal/ci/github/push_tip_to_trybot.cue +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2023 The CUE Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package github - -// push_tip_to_trybot "syncs" active branches to the trybot _repo. -// Since the workflow is triggered by a push to any of the branches, -// the step only needs to sync the pushed branch. -workflows: push_tip_to_trybot: _repo.pushTipToTrybotWorkflow & { - on: { - push: branches: _repo.protectedBranchPatterns - } - jobs: push: { - "runs-on": _repo.linuxMachine - if: "${{github.repository == '\(_repo.githubRepositoryPath)'}}" - } -} diff --git a/internal/ci/github/trybot_dispatch.cue b/internal/ci/github/trybot_dispatch.cue deleted file mode 100644 index 1a444ebc0f7..00000000000 --- a/internal/ci/github/trybot_dispatch.cue +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2022 The CUE Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package github - -// The trybot_dispatch workflow. -workflows: trybot_dispatch: _repo.bashWorkflow & _repo.trybotDispatchWorkflow diff --git a/internal/ci/github/workflows.cue b/internal/ci/github/workflows.cue index d7748ffe363..7ff11bd6fb3 100644 --- a/internal/ci/github/workflows.cue +++ b/internal/ci/github/workflows.cue @@ -40,10 +40,10 @@ import ( workflows: close({ [string]: json.#Workflow - (_repo.trybot.key): _ - trybot_dispatch: _ + (_repo.trybot.key): _ + trybot_dispatch: _repo.trybotDispatchWorkflow release: _ tip_triggers: _ - push_tip_to_trybot: _ + push_tip_to_trybot: _repo.pushTipToTrybotWorkflow evict_caches: _ })