-
Notifications
You must be signed in to change notification settings - Fork 15
ci(publishing): enforce conventional commit linting on the PR name #1413
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
Open
hoolioh
wants to merge
3
commits into
main
Choose a base branch
from
julio/versioning/enforce-conventional-commits-pr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+132
−0
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| module.exports = {extends: ['@commitlint/config-conventional']} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| name: pr-name | ||
| permissions: | ||
| pull-requests : read | ||
| contents: read | ||
| on: | ||
| pull_request: | ||
| types: ['opened', 'edited', 'reopened', 'synchronize'] | ||
| branches-ignore: | ||
| - "v[0-9]+.[0-9]+.[0-9]+" | ||
| - release | ||
|
|
||
| jobs: | ||
| pr_name_lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| persist-credentials: false | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 | ||
| name: Install Node.js | ||
| with: | ||
| node-version: 16 | ||
| - name: Install dependencies | ||
| run: | | ||
| npm install @commitlint/lint@18.6.1 @commitlint/load@18.6.1 @commitlint/config-conventional@18.6.2 @actions/core | ||
| - name: Lint PR name | ||
| uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 | ||
| with: | ||
| script: | | ||
| const load = require('@commitlint/load').default; | ||
| const lint = require('@commitlint/lint').default; | ||
|
|
||
| const CONFIG = { | ||
| extends: ['./.config/commitlint.config.js'], | ||
| }; | ||
|
|
||
| const title = context.payload.pull_request.title; | ||
|
|
||
| core.info(`Linting: ${title}`); | ||
|
|
||
| load(CONFIG) | ||
| .then((opts) => { | ||
| lint( | ||
| title, | ||
| opts.rules, | ||
| opts.parserPreset ? {parserOpts: opts.parserPreset.parserOpts} : {} | ||
| ).then((report) => { | ||
| report.warnings.forEach((warning) => { | ||
| core.warning(warning.message); | ||
| }); | ||
|
|
||
| report.errors.forEach((error) => { | ||
| core.error(error.message); | ||
| }); | ||
|
|
||
| if (!report.valid) { | ||
| core.setFailed("PR title linting failed"); | ||
| } | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: given that this is library code, where do you draw the line between "refactor" and "feat", for changes that affect APIs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My two cents: If capabilities or functionality aren't changing then it's a
refactor, even if it's a breaking change for a public API because something like a function name has changed. If you add a new parameter to a function it's likely afeat.@hoolioh Whatever we agree on should probably be documented to minimize confusion.