-
Notifications
You must be signed in to change notification settings - Fork 4
chore: create the GitHub release automatically on tag push (#DS-3378) #1887
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
Merged
Merged
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,27 @@ | ||
| # Categorization for the auto-generated release notes — both the `--generate-notes` call in the | ||
| # GitHub Release job of workflows/publish.yml and the "Generate release notes" button. | ||
| # | ||
| # Categories match on labels, which workflows/pr-label.yml derives from the conventional-commit | ||
| # type in the pull request title. Order matters: the first matching category wins, so a dependency | ||
| # bump that also carries a hand-applied `bug` label is listed above Bug Fixes on purpose. | ||
| changelog: | ||
| categories: | ||
| - title: ⚠️ Breaking Changes | ||
| labels: | ||
| - breaking changes | ||
| - title: 📦 Dependencies | ||
| labels: | ||
| - dependencies | ||
| - title: 🚀 Features | ||
| labels: | ||
| - enhancement | ||
| - title: 🐛 Bug Fixes | ||
| labels: | ||
| - bug | ||
| - title: 📖 Documentation | ||
| labels: | ||
| - documentation | ||
| # chore, build, refactor, test — everything the labeler does not classify. | ||
| - title: 🧰 Other Changes | ||
| labels: | ||
| - '*' |
This file was deleted.
Oops, something went wrong.
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,92 @@ | ||
| name: Label PR | ||
|
|
||
| # pull_request_target so pull requests opened from a fork are labeled too: the pull_request token | ||
| # is read-only for them. Nothing is checked out and no pull-request-controlled code runs here — | ||
| # only the title and body are read, and they reach the script through the environment. | ||
| on: | ||
| pull_request_target: | ||
| types: | ||
| - opened | ||
| - edited | ||
| - reopened | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| label: | ||
| name: Label | ||
| runs-on: ubuntu-latest | ||
| # Dependabot applies `dependencies` to its own pull requests. | ||
| # `edited` fires for body/base edits too, not just the title. `changes.title` only exists (and | ||
| # is truthy) when the title itself changed; it's simply absent — not an error — on `opened` and | ||
| # `reopened`, which have no `changes` object at all, so checking `action != 'edited'` first | ||
| # covers those without needing to read it. | ||
| if: >- | ||
| ${{ github.repository_owner == 'koobiq' && github.actor != 'dependabot[bot]' | ||
| && (github.event.action != 'edited' || github.event.changes.title) }} | ||
| permissions: | ||
| pull-requests: write # to add labels to the pull request | ||
| steps: | ||
| - name: Apply the labels matching the conventional-commit type | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| # Nothing is checked out here, and gh does not fall back to GITHUB_REPOSITORY. | ||
| GH_REPO: ${{ github.repository }} | ||
| PR_NUMBER: ${{ github.event.pull_request.number }} | ||
| # Already shaped by commitlint.yml, but still untrusted text: keep it out of the script. | ||
| PR_TITLE: ${{ github.event.pull_request.title }} | ||
| # Free-form text with no validation at all (commitlint only checks PR_TITLE) — kept out | ||
| # of the script the same way. | ||
| PR_BODY: ${{ github.event.pull_request.body }} | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| # These feed the categories in .github/release.yml. The scope is what separates a | ||
| # dependency bump from an ordinary chore. | ||
| labels=() | ||
|
|
||
| case "$PR_TITLE" in | ||
| feat*) labels+=(enhancement) ;; | ||
| fix*) labels+=(bug) ;; | ||
| docs*) labels+=(documentation) ;; | ||
| esac | ||
|
|
||
| # A separate, independent check: `case` only fires its first match, and a dependency | ||
| # bump commonly carries a type prefix too (e.g. `fix(deps): bump x`). release.yml lists | ||
| # Dependencies above Bug Fixes specifically to handle a PR that carries both labels. | ||
| case "$PR_TITLE" in | ||
| *'(deps)'*|*'(deps-dev)'*) labels+=(dependencies) ;; | ||
| esac | ||
|
|
||
| # `feat(scope)!:` — the conventional-commit marker for a breaking change. | ||
| case "$PR_TITLE" in | ||
| *'!:'*) labels+=('breaking changes') ;; | ||
| esac | ||
|
|
||
| # The footer form, per the conventional-commits spec — checked separately since it lives | ||
| # in the description, not the title. | ||
| case "$PR_BODY" in | ||
| *'BREAKING CHANGE:'*|*'BREAKING-CHANGE:'*) | ||
| # Title and body can both flag it — guard against adding the label twice. | ||
| case "${labels[*]-}" in | ||
| *'breaking changes'*) ;; | ||
| *) labels+=('breaking changes') ;; | ||
| esac | ||
| ;; | ||
| esac | ||
|
|
||
| if [ ${#labels[@]} -eq 0 ]; then | ||
| echo "No label maps to \"$PR_TITLE\"." | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Re-adding a label the pull request already carries is a no-op, so the `edited` and | ||
| # `reopened` re-runs are free. Labels are only ever added: a title corrected from `feat:` | ||
| # to `fix:` keeps the stale `enhancement` until someone removes it by hand. | ||
| add_label_flags=() | ||
| for label in "${labels[@]}"; do | ||
| add_label_flags+=(--add-label "$label") | ||
| done | ||
|
|
||
| gh pr edit "$PR_NUMBER" "${add_label_flags[@]}" |
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.
Uh oh!
There was an error while loading. Please reload this page.