Skip to content

ci: Add a workflow to check pull request title for correct prefix. #3080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

nr-ahemsath
Copy link
Member

@nr-ahemsath nr-ahemsath commented Apr 2, 2025

This PR adds a workflow to check the prefix of pull request titles to make sure that the start with a prefix and that the prefix is in the list of known good prefixes: feat, fix, security, notice, ci, chore, test, docs

I initially tested this in my fork. Unfortunately, the PR title as seen by the workflow logic does not get updated after PR creation. In other words, you can edit and change the PR title after initial creation, but the workflow only ever gets the initial value. So, if this check finds a problem with the PR title, the solution is to close the PR with the "bad" title/prefix and open another one with a correct prefix.

@nr-ahemsath nr-ahemsath requested a review from a team as a code owner April 2, 2025 22:00
@nrcventura
Copy link
Member

Does manually re-running the workflow allow it to see the updated title?

contents: read
pull-requests: read
steps:
- name: Check PR title
Copy link
Member

Choose a reason for hiding this comment

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

Need to add Harden Runner step here.

          - name: Harden Runner
            uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1
            with:
              disable-sudo: true
              egress-policy: audit

@tippmar-nr
Copy link
Member

Looks like there's already an action that does the same thing https://github.com/marketplace/actions/pr-title-checker - I wonder if it handles PR title changes?

@nr-ahemsath
Copy link
Member Author

Does manually re-running the workflow allow it to see the updated title?

Unfortunately no.

@nr-ahemsath
Copy link
Member Author

Marty found a better solution, closing this hand-rolled attempt.

@nr-ahemsath nr-ahemsath closed this Apr 3, 2025
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.

3 participants