From e9c99c36269b068d412d0ce5b0999ebbafdb3873 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Wed, 21 Aug 2024 14:46:58 +0100 Subject: [PATCH] [ci] add GitHub-based private CI Signed-off-by: Gary Guo --- .github/workflows/private-ci.yml | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/private-ci.yml diff --git a/.github/workflows/private-ci.yml b/.github/workflows/private-ci.yml new file mode 100644 index 00000000000000..c38bdccd6febcd --- /dev/null +++ b/.github/workflows/private-ci.yml @@ -0,0 +1,46 @@ +# Copyright lowRISC contributors (OpenTitan project). +# Licensed under the Apache License, Version 2.0, see LICENSE for details. +# SPDX-License-Identifier: Apache-2.0 + +name: Private CI + +on: + push: + branches-ignore: + - "backport-*" + tags: + - "*" + pull_request_target: + branches: + - "*" + +permissions: + contents: write # For repository dispatch + +jobs: + trigger: + name: Trigger Private CI + runs-on: ubuntu-latest + steps: + - name: Trigger Private CI + uses: actions/github-script@v7 + with: + script: | + const payload = { + sha: context.eventName === 'pull_request_target' ? context.payload.pull_request.head.sha : context.sha, + pull_request: context.issue.number, + inputs: { + // For push events, also send branch name (for batching) + branch: context.eventName === 'pull_request_target' ? undefined : context.ref, + run_name: context.eventName === 'pull_request_target' ? context.payload.pull_request.title : context.payload.head_commit.message.split('\n')[0], + }, + }; + await github.rest.repos.createDispatchEvent({ + owner: context.repo.owner, + repo: context.repo.repo, + event_type: 'cross-repo-ci', + client_payload: { + ...payload, + target: `${context.repo.owner}/opentitan-private-ci/master/private-ci-integrated.yml`, + } + });