Skip to content

Added PR labels checks#12

Open
ltshb wants to merge 3 commits into
mainfrom
develop
Open

Added PR labels checks#12
ltshb wants to merge 3 commits into
mainfrom
develop

Conversation

@ltshb

@ltshb ltshb commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Github branch nomenclature is used to automate PR labels which are then used to categorize Release Notes. Branch name otherwise are not so important and they are automatically deleted once the PR is merged. Therefore any convention enforcement do not really make sense and it would also be quite annoying because once a PR is open, you cannot change the name of the head branch, in that case you need to close the PR and reopen a new one.

However the PR labels are important and should be enforced for proper Release Note Categorization. That's why this PR now implement a supplementary github action that can be used with PR label and unlabel events. I also added a PR merge guards to prevent accidental merge of PR labeled as DO NOT MERGE or WIP.

This is a new reusable workflow which means that it needs to be added to every github repo. See https://github.com/swissgeo/infra-terraform/pull/423 for the workfow setup

Due to auto release note, branch pattern must be followed.

@asteiner-swisstopo asteiner-swisstopo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I would be fine with enforcing this.

I am less sure whether the naming convention should not be revised. For example, what I miss are prefixes for refactorings ("refactor") or maintenance ("chore").

There are also conventions like Conventional Branch and in general I have noticed that often git branch types are separated with a slash (/) rather than a dash. So for example hotfix/memory-leak-image-upload instead of hotfix-memory-leak-image-upload.

So maybe worth a small discussion in the Tuesday Tech Talk?

Comment thread .github/workflows/pr-auto-semver.yml Outdated
echo "Branch name is 'main', skipping pattern check"
exit 0
fi
expected_pattern="^(feature|feat|bugfix|bug|hotfix|hot|data|norn|skip-rn)[/_-].+$"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What do norn and skip-rn stand for? These are not mentioned in the doc-guidelines.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

My first guess is no release notes and skip release notes.

@ltflb-bgdi ltflb-bgdi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Makes sense. As @asteiner-swisstopo already mentioned, referring to official nomenclatures like conventional branch would make sense. At least we should agree on a prefix for work without a issue. Today, both no-issue and chore are used. Personally I would vote for chore. The way I understand it, this is what currently norn and skip-rn stand for.

@hansmannj

Copy link
Copy Markdown

What @asteiner-swisstopo and @ltflb-bgdi already said 😉
I like the idea of having some convention for branches with no underlying issues.

@ltshb

ltshb commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Maybe instead of enforcing a branch naming, we could should enforce the presence of a label. The branch is anyway deleted once merged and if we enforce a naming, then the PR needs to be closed and reopened. While labels can be updated.

@ltclm ltclm left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thank you! Good idea with the labels.

If we stick to the branch naming convention, I'd suggest keeping it in sync with what's documented here: https://github.com/geoadmin/doc-guidelines/blob/master/GIT_FLOW.md#personal-branches-naming-convention

Note that norn, skip-rn, and hot are currently missing from those guidelines.

@ltshb ltshb changed the title Added git branch validation pattern Added PR labels checks Jul 9, 2026
@ltshb

ltshb commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@hansmannj @ltflb-bgdi @asteiner-swisstopo I updated the PR for branch name convention to label enforcement. I haven't tested it yet.

The branch name was only used to auto-assign a label for release note
categorization, and the branch is deleted once the PR is merged, so its
naming is not important in itself. Labels are what actually matter: they
categorize release notes and can now also be used to block accidental
merges (e.g. via a "DO NOT MERGE" label), so validate labels directly
instead of enforcing a branch naming convention.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants