Skip to content

ci: harden the workflows, stop docs runs cancelling each other - #4

Merged
Jertlok merged 2 commits into
mainfrom
ci/harden-workflows
Sep 16, 2026
Merged

Jertlok merged 2 commits into
mainfrom
ci/harden-workflows

Conversation

@Jertlok

@Jertlok Jertlok commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

What and why

change practice it follows
concurrency: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}, cancel-in-progress only for pull requests Home Assistant core and astral-sh/uv use the same group. CI had no group, so every push or body edit left the previous run going.
timeout-minutes on every job GitHub's default is 360 minutes; rust-lang/rust and Home Assistant set explicit timeouts. Sized a few times the measured job duration.
merge_group trigger Required for a merge queue (GitHub docs).
Docs: builds grouped per pull request, only Deploy serialized; pages: write/id-token: write moved from the pull request build to the deploy job The single pages group made pull requests cancel each other's docs check (run 35028722871 was cancelled that way). GitHub's Pages starter workflow scopes the group to deployment.
Workflow lint job: actionlint + zizmor uv runs zizmor on every pull request (check-zizmor.yml); both tools are what the OpenSSF Scorecard and GitHub's security hardening guide checks are about (pinning, token permissions, injection).
CI passed aggregate job uv's "all required jobs passed": one required check, so adding or renaming a job never needs a ruleset change, and a failed or cancelled job cannot be skipped past.
.github/dependabot.yml: GitHub Actions weekly, grouped, 7-day cooldown Scorecard "Pinned-Dependencies" expects SHA pins to be kept current; the cooldown is zizmor's dependabot-cooldown recommendation. Dependabot commits need the maintainer's sign-off before merge like any other.
persist-credentials: false, least-privilege permissions zizmor artipacked / excessive-permissions.

Depends on

  1. ci: add shared commit check, workflow lint and app release .github#2 merged.
  2. While porthole-dev/.github is private: its Settings > Actions > General > Access set to "Accessible from repositories in the porthole-dev organization". Until then Workflow lint and CI passed fail with "Unable to resolve action porthole-dev/.github, repository not found".
  3. The pins (@43919fe... # main) moved to the merged commit and its tag (# v1.0.0); zizmor's ref-version-mismatch warns until the comment names a tag.

Merge note

porthole keeps its own Commit check (make trailers). It fails until the commit carries the maintainer's Signed-off-by (git rebase --signoff main).

@Jertlok
Jertlok force-pushed the ci/harden-workflows branch 2 times, most recently from 6f4f01b to e8b0b81 Compare September 16, 2026 06:26
@Jertlok
Jertlok force-pushed the ci/harden-workflows branch from ca8bffd to 961cf41 Compare September 16, 2026 06:37
- CI had no concurrency group: every push to a pull request, and every
  body edit, left the previous run going. Superseded pull request runs are
  now cancelled; pushes to main keep theirs.
- Docs put every run, pull requests included, in one "pages" group. A
  pull request's build waited for any other, and GitHub cancels a pending
  run when a newer one joins its group, so one pull request could cancel
  another's docs check (run 35028722871). Builds are grouped per pull
  request; only the deploy job is serialized.
- The docs build job held pages: write and id-token: write on every pull
  request only for configure-pages. That step moves to the deploy job,
  which runs on main with PUBLISH_DOCS set; builds get a read-only token.
- vars.PUBLISH_DOCS reaches the shell through env instead of template
  substitution (zizmor template-injection).
- persist-credentials: false on every checkout (zizmor artipacked),
  timeouts on every job, runners pinned to ubuntu-24.04, merge_group.
- Workflow lint (actionlint, zizmor) and a "CI passed" aggregate job from
  porthole-dev/.github, as uses: steps so ci.yml still runs nothing but
  make targets.
- Dependabot keeps the pinned actions current, weekly and grouped, with a
  seven-day cooldown.

Assisted-by: Claude
Signed-off-by: Giuseppe Maggio <jertlok@proton.me>
The previous pin named a commit from the pull request branch, which the
rebase merge orphaned; an orphaned commit can be garbage-collected and the
action then stops resolving. Point at the commit main was tagged v1.0.0.

Assisted-by: Claude
Signed-off-by: Giuseppe Maggio <jertlok@proton.me>
@Jertlok
Jertlok force-pushed the ci/harden-workflows branch from 961cf41 to 397e48c Compare September 16, 2026 07:36
@Jertlok
Jertlok merged commit 749f3ec into main Sep 16, 2026
10 checks passed
@Jertlok
Jertlok deleted the ci/harden-workflows branch September 16, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant