Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/release-prepare-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Trigger release preparation

on:
workflow_run:
workflows: ["Test"]
types: [completed]

permissions: {}

concurrency:
group: release-prepare-trigger
cancel-in-progress: false

jobs:
dispatch:
name: Dispatch tested master
if: >-
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
github.event.workflow_run.head_branch == 'master'
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
steps:
- name: Dispatch exact current master
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
env:
TESTED_SHA: ${{ github.event.workflow_run.head_sha }}
with:
script: |
const testedSha = process.env.TESTED_SHA;
if (!/^[0-9a-f]{40}$/.test(testedSha)) {
throw new Error(`Invalid tested SHA: ${testedSha}`);
}
const { owner, repo } = context.repo;
const master = await github.rest.git.getRef({ owner, repo, ref: 'heads/master' });
if (master.data.object.sha !== testedSha) {
core.notice(`Skipping stale tested SHA ${testedSha}; master is ${master.data.object.sha}.`);
return;
}
await github.rest.actions.createWorkflowDispatch({
owner,
repo,
workflow_id: 'release-prepare.yml',
ref: 'master',
inputs: { targetSha: testedSha },
});
core.notice(`Dispatched release preparation for tested master ${testedSha}.`);
Loading