Skip to content

fix: add runs-on input to all shared workflows - #46

Merged
zepeng811 merged 2 commits into
circlefin:masterfrom
polochang-circle:fix/attach-release-assets-runs-on-input
Nov 12, 2026
Merged

zepeng811 merged 2 commits into
circlefin:masterfrom
polochang-circle:fix/attach-release-assets-runs-on-input

Conversation

@polochang-circle

@polochang-circle polochang-circle commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This repository holds 4 reusable workflows. Only pr-scan.yaml lets the caller select a runner. The other 3 hardcode runs-on: ubuntu-latest.

This PR adds a runs-on input to those 3 workflows:

Workflow Job Before After
attach-release-assets.yaml release_attach_assets ubuntu-latest ${{ inputs.runs-on }}
actions-lint.yaml lint_validate_actions ubuntu-latest ${{ inputs.runs-on }}
conventional-commit-release.yaml commit-lint ubuntu-latest ${{ inputs.runs-on }}
conventional-commit-release.yaml release ubuntu-latest ${{ inputs.runs-on }}

Each new input copies the runs-on input that pr-scan.yaml already defines. The description text, required: false, type: string and the ubuntu-latest default all match that input. conventional-commit-release.yaml applies one input to both of its jobs.

pr-scan.yaml keeps its current content. This PR does not change it.

The default keeps the current behaviour, so no existing caller changes.

Why this change is needed

A GitHub organization can enforce a runner policy. Such a policy can forbid the GitHub-hosted ubuntu-* labels and allow only approved runners. The policy then cancels any run that uses a forbidden label.

A policy of that kind reads every job in the caller workflow file. It also reads the jobs of each reusable workflow that the caller starts. It reads a job even when an if condition skips that job.

A hardcoded runs-on therefore breaks the caller in two ways:

  1. The caller cannot select an approved runner for the reusable workflow.
  2. The caller loses its whole run, even when the affected job never starts.

Point 2 is the harder one. A caller that starts attach-release-assets.yaml only on a push to the default branch still loses its pull request runs, because the policy reads the skipped job too.

The same risk applies to actions-lint.yaml and conventional-commit-release.yaml. This PR covers all 3 workflows together, so no gap remains.

A caller-supplied runs-on also helps anyone who wants a larger runner or a self-hosted runner for these workflows.

Decision: this PR keeps the harden-runner step

PR #38 removes the step-security/harden-runner step and the id-token: write permission from these workflows. That removal assumes the job always runs on a custom runner that carries a built-in security agent.

That assumption holds only while runs-on stays hardcoded to such a runner. Once runs-on becomes a caller input, the workflow cannot know what the caller passes. A caller that passes ubuntu-latest would then run with no runner-level agent and no workflow-level harden-runner.

I considered an if: condition that starts harden-runner only on a runner without a built-in agent. I rejected that option for three reasons:

  1. The condition must match runner labels as strings. A caller may pass a label, a runner group name, or a JSON array. A string match is unreliable.
  2. The condition must hold a list of approved labels. That list changes over time, and this repository is public.
  3. A fork of this repository has a different label set. The condition gives the wrong result there.

This PR therefore keeps harden-runner for every runner.

Please confirm one point: the harden-runner action must support a runner that already carries a security agent. I did not test that combination.

Relationship to PR #38

I opened a separate PR instead of a rebase of #38. PR #38 changes the same 4 files. Reasons:

I excluded the SHA pinning from this PR, because master already has it.

I did not close #38. Please decide what to do with it. I recommend that you close it in favour of this PR.

Open question for the repo owner: which default?

This PR uses ubuntu-latest as the default for all 3 inputs. That value keeps the current behaviour and matches pr-scan.yaml. Please confirm that choice or change it.

The trade-off:

  • ubuntu-latest works for every consumer. Each consumer that needs another runner must then pass one.
  • A specific organization label is convenient for that one organization. A consumer outside it cannot resolve the label. GitHub does not fail on an unresolved label. The job queues until it times out.

This repository is public and has 14 forks. I could not determine if a real external consumer exists. That answer decides the default.

Required follow-up: the v1 tag

A merge of this PR does not reach any consumer. Consumers use @v1.

The v1 tag points to 057a20a7d108daaad3dc5e8e119cc2d53e42207c, which is release v1.3.5. The tags v1, v1.3 and stable all still point to that commit. master is 7 commits ahead, up to release v1.3.8.

The automatic tag move failed. The "Create additional tags" step of run 28533433898 failed with this error:

HttpError: Resource not accessible by integration - https://docs.github.com/rest/git/refs#create-a-reference

The release token appears to lack permission to write a git reference.

Two actions remain outside the scope of this PR:

  1. Someone must repair the token permission for the "Create additional tags" step.
  2. Someone must move v1, v1.3 and stable to a commit that contains this change.

The stable tag matters too. The "Checkout Configs" step of pr-scan.yaml checks out this repository at ref: stable.

I move no tag in this PR. Please tell me who owns that step.

Testing

🤖 Generated with Claude Code

@polochang-circle polochang-circle changed the title fix: add runs-on input to attach-release-assets workflow fix: add runs-on input to all shared workflows Nov 12, 2026
polochang-circle and others added 2 commits November 12, 2026 18:28
The job hardcoded `ubuntu-latest`. A caller could not select a runner.

A GitHub org can enforce a runner policy that forbids the
GitHub-hosted `ubuntu-*` labels. Such a policy reads every job of
each reusable workflow that a caller starts. It reads a job even
when an `if` condition skips that job. A hardcoded label then
cancels the whole run of that caller.

This change adds a `runs-on` input. The job now reads that input.
The input copies the existing `runs-on` input of `pr-scan.yaml`.
The default stays `ubuntu-latest`, so current callers see no change.

This change keeps the harden-runner step. The workflow cannot know
if the caller-supplied runner carries a security agent.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A caller could not select a runner for these two reusable workflows.
Both hardcoded `ubuntu-latest`.

An org runner policy that forbids GitHub-hosted labels cancels the
whole run of such a caller. The policy reads the jobs of each
reusable workflow that the caller starts.

This change adds the same `runs-on` input that `pr-scan.yaml`
defines. Each job now reads that input.
`conventional-commit-release.yaml` applies one input to both of its
jobs. The default stays `ubuntu-latest`, so current callers see no
change.

All 4 reusable workflows now accept a caller-supplied runner.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@polochang-circle
polochang-circle force-pushed the fix/attach-release-assets-runs-on-input branch from 0b6a6a1 to 476b6a6 Compare November 12, 2026 10:28
@zepeng811
zepeng811 merged commit 355c869 into circlefin:master Nov 12, 2026
6 checks passed
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.

2 participants