Skip to content
Merged
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
39 changes: 30 additions & 9 deletions .github/workflows/manual_release_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ on:
required: false
type: string
default: ""
skip_checks:
description: Skip the release branch and `Checks` gate for the built commit. The calling workflows run their own gate.
required: false
type: boolean
default: true

permissions:
contents: read
Expand All @@ -37,15 +42,6 @@ jobs:
sha: ${{ steps.sha.outputs.sha }}

steps:
# Gate manual dispatches on the `Checks` workflow already succeeding on this commit (run by `on_master.yaml`);
# skipped when called from another workflow.
- name: Wait for checks
if: github.event_name == 'workflow_dispatch'
uses: apify/actions/wait-for-checks@v1.6.2
with:
ref: ${{ github.sha }}
check-regexp: ^Checks

- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand All @@ -56,6 +52,31 @@ jobs:
id: sha
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"

# A manual dispatch builds only a commit that is on a release branch and passed the `Checks` workflow (run by
# `on_master.yaml`). Calling workflows skip both steps through `skip_checks`.
- name: Check that the commit is on a release branch
if: ${{ !inputs.skip_checks }}
env:
GH_TOKEN: ${{ github.token }}
SHA: ${{ steps.sha.outputs.sha }}
run: |
branches=$(gh api --paginate "repos/$GITHUB_REPOSITORY/branches" --jq '.[].name' | grep -E '^(master|release-v.+)$')
for branch in $branches; do
status=$(gh api "repos/$GITHUB_REPOSITORY/compare/$branch...$SHA" --jq .status || true)
if [[ "$status" == "identical" || "$status" == "behind" ]]; then
exit 0
fi
done
echo "::error::$SHA is not on a release branch"
exit 1

- name: Wait for checks
if: ${{ !inputs.skip_checks }}
uses: apify/actions/wait-for-checks@v1.6.2
with:
ref: ${{ steps.sha.outputs.sha }}
check-regexp: ^Checks

- name: Set up Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
Expand Down
Loading