Skip to content

ci: drop external action for checking PR title format#2388

Open
james-garner-canonical wants to merge 3 commits intocanonical:mainfrom
james-garner-canonical:26-03+ci+roll-our-own-semantic-commit-names
Open

ci: drop external action for checking PR title format#2388
james-garner-canonical wants to merge 3 commits intocanonical:mainfrom
james-garner-canonical:26-03+ci+roll-our-own-semantic-commit-names

Conversation

@james-garner-canonical
Copy link
Contributor

@james-garner-canonical james-garner-canonical commented Mar 23, 2026

This PR drops the use of an external, third-party action for checking PR title format, replacing it with a small, locally-defined Python script. This has the added security benefit of letting us run this check in the safer pull_request context, rather than on pull_request_target, which the action apparently required for creating a commit status.

I'm proposing the same approach for charmlibs in canonical/charmlibs#380

The script in this repo disallows the use of conventional commit scopes, and uses the same set of commits that Ops uses.


In addition to running sanity tests locally with the environment variable set to different values, I've tested it in our CI by editing this PRs title several times.

Due to the workflow's concurrency definition, you'll notice that the pull_request version and pull_request_target version race and one gets cancelled. This will be resolved when this PR is merged and only one check is defined.

@james-garner-canonical james-garner-canonical changed the title ci: drop external action for checking PR title format ci(scope): drop external action for checking PR title format Mar 23, 2026
@james-garner-canonical james-garner-canonical changed the title ci(scope): drop external action for checking PR title format ci(scope2): drop external action for checking PR title format Mar 23, 2026
@james-garner-canonical james-garner-canonical changed the title ci(scope2): drop external action for checking PR title format ci: drop external action for checking PR title format Mar 23, 2026
@james-garner-canonical james-garner-canonical marked this pull request as ready for review March 23, 2026 02:29
test
disallowScopes: ".*"
persist-credentials: false
- run: python3 .github/check-conventional-pr-title.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about attempting a super-compact inline Python block instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love the idea, I think that will be harder to maintain in future


on:
pull_request_target: # zizmor: ignore[dangerous-triggers] Doesn't touch code - pull_request results in cancellation errors.
pull_request:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd be back to cancellation errors, unless the concurrency group is removed or changed.

Maybe it's cleaner to the remove concurrency seeting, given how simple the job is.

Copy link
Contributor Author

@james-garner-canonical james-garner-canonical Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the cancelation errors are only due to there being two workflows running right now, the pull_request trigger one from this branch, and the pull_request_target one from main.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt that. We used to have on: pull_request originally, and had those cancellation errors. I think it's because pushing the branch and creating a PR triggers both "pr created" and "code pushed" events. TBH I never found the root cause.

Copy link
Contributor Author

@james-garner-canonical james-garner-canonical Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm certain that the cancellations we see in this PR are because both the pull_request trigger from this branch, and the pull_request_target trigger from main are running here, and they define the same concurrency group.

I know those aren't the errors you're talking about, just to be clear.

I suggest we merge this PR and keep an eye out for cancellation errors thereafter. If we see the issue you remember, then let's remove the concurrency. I believe the idea with concurrency for this job is to avoid multiple quick PR edits resulting in spurious failures if an intermediate edit made a mistake.

james-garner-canonical added a commit to canonical/charmlibs that referenced this pull request Mar 26, 2026
This PR drops the use of an external, third-party action for checking PR
title format, replacing it with a small, locally-defined Python script.
This has the added security benefit of letting us run this check in the
safer `pull_request` context, rather than on `pull_request_target`,
which the action apparently required for creating a [commit
status](https://docs.github.com/en/rest/commits/statuses?apiVersion=2026-03-10).

I'm proposing the same approach for `operator` in
canonical/operator#2388
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