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
51 changes: 51 additions & 0 deletions .github/workflows/parity-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,35 @@ name: "Parity: latest releases"
# shipped that breaks parity, which needs a pin bump or a fix, but it must
# never gate a PR. The nightly schedule catches a release landing while
# nothing here changes.
#
# Docs-only changes cannot affect parity, so they skip this non-blocking
# check. The pinned check has no filter: if it is a required status check, a
# filtered-out run would leave the PR waiting forever.
on:
pull_request:
paths-ignore:
- "**.md"
- LICENSE
- .gitignore
push:
branches: [main]
paths-ignore:
- "**.md"
- LICENSE
- .gitignore
schedule:
- cron: "30 6 * * *"
workflow_dispatch:

permissions:
contents: read

# A newer push to a PR supersedes its older runs, so cancel them. Runs on main
# (push, nightly, manual) are never cancelled.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
versions:
name: Resolve versions
Expand All @@ -30,16 +48,49 @@ jobs:
ruby_ref: ${{ steps.resolve.outputs.ruby_ref }}
defs: ${{ steps.resolve.outputs.defs }}
defs_sha: ${{ steps.resolve.outputs.defs_sha }}
skip: ${{ steps.skip.outputs.skip }}
steps:
- uses: actions/checkout@v7
with:
# Full history, so the skip step can diff against the base commit.
fetch-depth: 0
- id: resolve
env:
GH_TOKEN: ${{ github.token }}
run: scripts/resolve-versions.sh latest
# When nothing has been released past the pins, latest is exactly the
# pinned versions, which the pinned workflow already tests, so skip the
# comparison. Still run it on a manual dispatch, or when this change
# touches the latest-release machinery itself (or the diff base is
# unknown), since only this workflow exercises that.
- id: skip
env:
EVENT: ${{ github.event_name }}
BASE: ${{ github.event.pull_request.base.sha || github.event.before }}
GO_REF: ${{ steps.resolve.outputs.go_ref }}
RUBY_REF: ${{ steps.resolve.outputs.ruby_ref }}
DEFS_SHA: ${{ steps.resolve.outputs.defs_sha }}
run: |
pinned="$(GITHUB_OUTPUT= scripts/resolve-versions.sh pinned | grep -E '^(go_ref|ruby_ref|defs_sha)=')"
latest="$(printf 'go_ref=%s\nruby_ref=%s\ndefs_sha=%s\n' "$GO_REF" "$RUBY_REF" "$DEFS_SHA")"
skip=false
if [ "$pinned" = "$latest" ] && [ "$EVENT" != workflow_dispatch ]; then
skip=true
if [ "$EVENT" != schedule ] && ! git diff --quiet "$BASE" HEAD -- \
scripts/use-latest-release.sh scripts/resolve-versions.sh \
ruby/Gemfile.latest Makefile .github/workflows/parity-latest.yml; then
skip=false
fi
fi
if [ "$skip" = true ]; then
echo "::notice title=Latest releases match the pins::Skipping the comparison: the pinned workflow already tests these exact versions."
fi
echo "skip=$skip" >> "$GITHUB_OUTPUT"

latest:
name: "Latest releases (non-blocking): Go go-holidays ${{ needs.versions.outputs.go }} = Ruby holidays ${{ needs.versions.outputs.ruby }}, definitions ${{ needs.versions.outputs.defs }}"
needs: versions
if: needs.versions.outputs.skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/parity-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,35 @@ name: "Parity: unreleased main branches"
# here means an upcoming release would break parity, which is worth knowing
# before it ships, but it must never gate a PR. The nightly schedule catches
# drift that lands in either repo while nothing here changes.
#
# Docs-only changes cannot affect parity, so they skip this non-blocking
# check. The pinned check has no filter: if it is a required status check, a
# filtered-out run would leave the PR waiting forever.
on:
pull_request:
paths-ignore:
- "**.md"
- LICENSE
- .gitignore
push:
branches: [main]
paths-ignore:
- "**.md"
- LICENSE
- .gitignore
schedule:
- cron: "0 6 * * *"
workflow_dispatch:

permissions:
contents: read

# A newer push to a PR supersedes its older runs, so cancel them. Runs on main
# (push, nightly, manual) are never cancelled.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
versions:
name: Resolve versions
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/parity-pinned.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ on:
permissions:
contents: read

# A newer push to a PR supersedes its older runs, so cancel them. Runs on main
# (push, nightly, manual) are never cancelled.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
versions:
name: Resolve versions
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ moment a release ships, or a commit lands, without a pin catching up.
Both non-blocking checks also run nightly, to catch drift that lands in either
repo while nothing here changes.

To save runner time:

- A new push to a PR cancels that PR's older, still-running checks. Runs on
`main` are never cancelled.
- Changes that only touch docs (`*.md`, `LICENSE`, `.gitignore`) skip the two
non-blocking checks. The pinned check always runs.
- When `latest release` resolves to exactly the pinned versions, the latest
check skips its comparison, since the pinned check already tests those
versions. It still runs on a manual dispatch, and on any change to the
latest-release scripts, `ruby/Gemfile.latest`, the `Makefile`, or its own
workflow.

For `latest release` and `main`, `definitions/` is checked out at whatever
commit that go-holidays version pins (see the data note below), so the two
sides still resolve the same rules. `scripts/use-latest-release.sh` and
Expand Down
Loading