Skip to content

ci(validate): Update PR validation workflow and valid tags#2426

Merged
xezon merged 2 commits intoTheSuperHackers:mainfrom
tintinhamans:arctic/ci-titles-commits
Mar 9, 2026
Merged

ci(validate): Update PR validation workflow and valid tags#2426
xezon merged 2 commits intoTheSuperHackers:mainfrom
tintinhamans:arctic/ci-titles-commits

Conversation

@tintinhamans
Copy link

@tintinhamans tintinhamans commented Mar 8, 2026

This pull request updates the pull request validation workflow to enforce conventional commit standards for PR titles and commit messages.

  • Updated to use ubuntu-slim instead of ubuntu-latest which is a smaller container-based image - should theoretically start faster and also complete faster since this workflow is not heavy.
  • Replaced the old tag list in .github/workflows/valid-tags.txt with conventional commit types specified in CONTRIBUTING.md
  • Updated the regex logic in validate-pull-request.yml to require PR titles and commit messages to follow the conventional commit format: type(scope): Description or type: Description, using the new tag list.
  • Added automated PR comments when validation fails, detailing invalid titles and commit messages, and deleting previous bot comments to avoid spam.

Sample comment:

image
  • Changed the workflow trigger from pull_request to pull_request_target for improved security and to allow validation of PRs from forks while still being able to post comments.
  • Various other fixes.

@tintinhamans tintinhamans changed the title ci: Update PR validation workflow and valid tags ci(validate): Update PR validation workflow and valid tags Mar 8, 2026
@greptile-apps
Copy link

greptile-apps bot commented Mar 8, 2026

Greptile Summary

This PR overhauls the PR validation workflow to enforce conventional commit standards, replacing the old bracket-tag system ([GEN], [ZH], etc.) with typed prefixes (feat:, fix:, ci(scope):, etc.). The switch from pull_request to pull_request_target — combined with checking out only the base branch — correctly enables posting comments on fork PRs while keeping the privileged token away from untrusted code. Security hardening throughout (random-delimiter heredocs for GITHUB_ENV, context exposed as env vars instead of inline ${{ }} in run blocks, --paginate for complete comment cleanup) is well done.

Key changes:

  • valid-tags.txt: Replaced 7 project-specific bracket tags with 14 conventional commit types; revert and unify are project extensions beyond the standard set.
  • validate-pull-request.yml: Complete rewrite — conventional commit regex ^((type)(\([^)]+\))?: [A-Z].*)$, randomised heredoc delimiters to prevent injection, automated failure comments with stale-comment deletion, ubuntu-slim runner, concurrency guard, and separated fail step so comments always post before the job fails.
  • CONTRIBUTING.md: Adds revert to the allowed types list, capitalises "Good" example descriptions, and updates action-word examples to be consistent with the new uppercase requirement enforced by the regex.

One minor item worth noting:

  • The INVALID_COMMITS_LIST string always ends with a trailing \n, which produces a spurious blank line in the posted comment between the commit list and the format explanation section.

Confidence Score: 5/5

  • This PR is safe to merge; the workflow is well-hardened and the security model is sound.
  • All critical security and logic issues have been successfully addressed: GITHUB_ENV injection hardened with randomized delimiters, full pagination for comment cleanup, environment variable exposure for injection prevention, and proper conditional guards to prevent silent failures. The workflow correctly uses pull_request_target with base-branch checkout to safely handle fork PRs while keeping the privileged token away from untrusted code. The one remaining item — a trailing newline producing a cosmetic blank line in comment formatting — is a minor formatting issue that does not affect functionality, security, or correctness. The PR is ready to merge.
  • No files require special attention beyond the cosmetic formatting note in .github/workflows/validate-pull-request.yml.

Last reviewed commit: f6be43d

@tintinhamans tintinhamans force-pushed the arctic/ci-titles-commits branch 2 times, most recently from fe12d72 to e303693 Compare March 8, 2026 14:50
@tintinhamans tintinhamans marked this pull request as draft March 8, 2026 14:58
@tintinhamans tintinhamans force-pushed the arctic/ci-titles-commits branch from e303693 to 42085c2 Compare March 8, 2026 15:27
@tintinhamans tintinhamans marked this pull request as ready for review March 8, 2026 15:29
@tintinhamans tintinhamans force-pushed the arctic/ci-titles-commits branch from 42085c2 to d89293d Compare March 8, 2026 15:38
@tintinhamans tintinhamans force-pushed the arctic/ci-titles-commits branch from d89293d to 40d5cdc Compare March 8, 2026 15:52
@tintinhamans tintinhamans force-pushed the arctic/ci-titles-commits branch from 40d5cdc to 10c553a Compare March 8, 2026 15:59
@tintinhamans tintinhamans force-pushed the arctic/ci-titles-commits branch from 10c553a to 8f18430 Compare March 8, 2026 22:22
@tintinhamans tintinhamans force-pushed the arctic/ci-titles-commits branch from 8f18430 to c5986bc Compare March 8, 2026 22:30
@tintinhamans tintinhamans force-pushed the arctic/ci-titles-commits branch from c5986bc to f4a1677 Compare March 8, 2026 22:53
@tintinhamans tintinhamans requested a review from Skyaero42 March 9, 2026 08:10
@tintinhamans tintinhamans force-pushed the arctic/ci-titles-commits branch 2 times, most recently from ed88c6e to ce1a5ff Compare March 9, 2026 08:57
@tintinhamans tintinhamans force-pushed the arctic/ci-titles-commits branch from ce1a5ff to b51dc36 Compare March 9, 2026 09:05
@tintinhamans tintinhamans force-pushed the arctic/ci-titles-commits branch from b51dc36 to 1412664 Compare March 9, 2026 09:20
Signed-off-by: tintinhamans <5984296+tintinhamans@users.noreply.github.com>
@tintinhamans tintinhamans force-pushed the arctic/ci-titles-commits branch from 1412664 to a36fa4b Compare March 9, 2026 09:41
Signed-off-by: tintinhamans <5984296+tintinhamans@users.noreply.github.com>
@tintinhamans tintinhamans force-pushed the arctic/ci-titles-commits branch from a36fa4b to f6be43d Compare March 9, 2026 09:52
Copy link

@Skyaero42 Skyaero42 left a comment

Choose a reason for hiding this comment

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

This looks good to me.

Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

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

Looking good

@xezon xezon merged commit 926ffff into TheSuperHackers:main Mar 9, 2026
23 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.

3 participants