Skip to content

refactor(ci): pass static PR-title scopes from the Copier answers #7

Done

Description

@dan-petty

Problem

The reusable PR-title workflow builds its scope list at run time with its own script.

The code (lines at commit 39f92fb):

  • scripts/pr-title-scopes.sh:23-30 reads the scope/* labels of .github/labels.yml with yq. It adds ci, deps, docs, main and spec.
  • .github/workflows/pr-title.yml:73-131 makes a second checkout of this repository and installs mise and yq. It runs the script and passes the list to the scopes input of amannn/action-semantic-pull-request.
  • Size: 30 lines of script, about 50 lines of workflow, and 9 test cases in tests/test-pr-title-scopes.sh.
  • This code was in dan-petty/infra before feat: call the workflows of github-workflows infra#235 moved it here.

Breakage in 30 days:

The list is already known when Copier renders a repository. Each consumer renders labels.yml from the Copier answer scopes (labels.yml.jinja:13-21, copier.yml:55-67). So the script reads at run time a list that the template wrote at render time.

Change

Pass a static scope list to the scopes input of the action.

  • Tool: action-semantic-pull-request (https://github.com/amannn/action-semantic-pull-request), MIT, v6.1.4 (2026-11-24). It has the inputs scopes and requireScope.
  • Add a scopes input to the reusable workflow pr-title.yml. Pass it to the scopes input of the action with no change.
  • The template caller templates/repository/.github/workflows/pr-title.yml.jinja renders with: scopes: from the Copier answer scopes, plus the fixed scopes ci, deps, docs, main and spec.
  • .github/workflows/pr-title-caller.yml of this repository writes its own list.
  • The PR that adds a scope answer also renders the caller again. So the check of that PR reads the new list.

Delete:

  • scripts/pr-title-scopes.sh and tests/test-pr-title-scopes.sh.
  • The second checkout, the install of mise and yq, and the step "Read the scopes of the labels file" in pr-title.yml.
  • The text of the spec pr-title-scopes that describes the run-time read.

Out of scope, because they are not a reimplementation:

Existing tool considered

  • amannn/action-semantic-pull-request (MIT, v6.1.4). Its scopes input takes a static list. It does not read labels, and with a rendered list it does not need to.
  • commitlint scope-enum (MIT, v21.2.4). It does the same check with a static list. It adds a second tool, so it is not chosen.
  • No scope list. This is also possible: the action then accepts each scope.

Done when

  • scripts/pr-title-scopes.sh, its test and the extra workflow steps are deleted.
  • A Copier render of a consumer gives a caller with with: scopes:, and actionlint accepts it.
  • In a consumer, the PR-title check passes for a title with the scope deps, and fails for a title with an unknown scope.

Source

Source: https://github.com/dan-petty/github-workflows/blob/39f92fb644e550f84a5797cce46a80a891231d4a/scripts/pr-title-scopes.sh

Activity

  1. added
    type/refactor
    status/new
    on Nov 28, 2026
  2. dan-petty commented on Nov 28, 2026

    @dan-petty
    OwnerAuthor
    • Priority: Five PRs in two repositories failed the PR-title check because the runtime scope list was wrong, causing repeated CI check failures for valid work.
    • Related: build(release): tag infra releases with release-please infra#5, which asks for a different change. Both use Copier answers and labels.yml, but item 5 adds a new answer for non-scope labels while the candidate changes how the scope list reaches the PR-title action.
  3. added
    value/medium
    effort/medium
    source/agent
    scope/ci
    priority/p1-high
    owner/agent
    on Nov 28, 2026
  4. dan-petty commented on Nov 30, 2026

    @dan-petty
    OwnerAuthor

    An agent claimed this issue. The change also holds these parts:

    1. The input scopes of pr-title.yml is required. A caller that gives no scopes input cannot start the workflow, so the change is breaking.
    2. The line validateSingleCommit: true goes, and the workflow gets no input for it. A caller must set squash_merge_commit_title to PR_TITLE, as the settings baseline of the template does. The squash commit then gets the pull request title.
    3. The job asks only for the permission pull-requests: read. It checks out no file.
    4. The template caller passes runs-on: ${{ vars.RUNNER }}. A repository can then move the job to its own runner. With no variable, the job runs on ubuntu-26.04.
    5. release-please-config.json gets bump-minor-pre-major: true. The breaking change then releases v0.4.0, not v1.0.0.

    Tests: tests/test-repository-template.sh gets cases for the scopes of the rendered caller. No test reads a workflow of this repository.

    The criterion about a consumer needs the release and the copier update of that consumer. The pull request cannot show it.

  5. added
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 30, 2026
  6. dan-petty commented on Nov 30, 2026

    @dan-petty
    OwnerAuthor

    #40 merged as d11457e, and release v0.4.0 holds it.

    Proven: a title with the scope ci passed the check of this repository, and a title with an unknown scope failed it (the comment of #40 gives the runs).

    Not yet proven: the criterion about a consumer. It needs the copier update of a repository that the template rendered to v0.4.0. On that update, a title with the scope deps must pass PR title / Semantic PR title, and a title with an unknown scope must fail it.

    Follow-up: dan-petty/infra#283 (the caller of infra), dan-petty/devtools#149 (a document), dan-petty/devops-cli#7921 (the title rule of devops pr).

  7. removed
    status/in-review
    owner/agent
    on Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p1-highscope/cisource/agenttype/refactorvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions