forked from sandialabs/firewheel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Add new CI actions to autotag PRs and update release notes and ch…
…angelog entries (sandialabs#62) This PR is an effort to improve the OSS development process for FIREWHEEL. In it, we add the following GitHub actions: - [amannn/action-semantic-pull-request](https://github.com/amannn/action-semantic-pull-request) - Validate that PR titles have the general style of [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). We have also extended the default list to add a few new commit "types". - [release-drafter/release-drafter](https://github.com/release-drafter/release-drafter) - Drafts the next release notes as pull requests are merged into main. - This action also includes an "autolabeler" which checks the branch name and PR title to automatically add a label to the request. - [danielchabr/pr-labels-checker](https://github.com/danielchabr/pr-labels-checker) - Github Action to check if a PR has at least one of the expected labels - [stefanzweifel/changelog-updater-action](https://github.com/stefanzweifel/changelog-updater-action) - A GitHub Action to automatically update a "Keep a Changelog" CHANGELOG with the latest release notes. These four actions work together to ensure that each PR will be accurately labeled and that, when merged, will ensure that the release notes are correctly updated. Finally, when we issue a release, the changelog will also be updated. This has been tested in a separate repository and seems to work as expected. Note that this PR will fail the CI pipeline as the release-drafter configuration is not in our default branch yet.
- Loading branch information
Showing
7 changed files
with
313 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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 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,141 @@ | ||
# This release drafter follows the conventions | ||
# from https://keepachangelog.com | ||
|
||
name-template: 'v$RESOLVED_VERSION' | ||
tag-template: 'v$RESOLVED_VERSION' | ||
template: | | ||
$CHANGES | ||
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION | ||
categories: | ||
- title: 🚀 Features | ||
labels: | ||
- feature | ||
- enhancement | ||
- title: 🐛 Bug Fixes | ||
labels: | ||
- fix | ||
- bug | ||
- title: ⚠️ Changes | ||
labels: | ||
- changed | ||
- chore | ||
- style | ||
- refactor | ||
- test | ||
- perf | ||
- chore | ||
- title: ⚙️ Build/CI | ||
labels: | ||
- ci | ||
- build | ||
- title: ⛔️ Deprecated | ||
labels: | ||
- deprecated | ||
- title: 🗑 Removed | ||
labels: | ||
- removed | ||
- title: 🔐 Security | ||
labels: | ||
- security | ||
- title: 📄 Documentation | ||
labels: | ||
- docs | ||
- documentation | ||
- title: 🧩 Dependency Updates | ||
labels: | ||
- deps | ||
- dependencies | ||
collapse-after: 5 | ||
|
||
change-template: '- $TITLE @$AUTHOR ([#$NUMBER](https://github.com/sandialabs/firewheel/pull/$NUMBER))' | ||
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. | ||
version-resolver: | ||
major: | ||
labels: | ||
- major | ||
minor: | ||
labels: | ||
- minor | ||
patch: | ||
labels: | ||
- patch | ||
default: patch | ||
|
||
exclude-labels: | ||
- skip-changelog | ||
|
||
autolabeler: | ||
- label: 'feature' | ||
branch: | ||
- /(feature|feat)[-\/].+/ | ||
title: | ||
- /(feature|feat)[:].+/ | ||
- label: 'fix' | ||
branch: | ||
- /(fix|bug|bugfix)[-/].+/ | ||
title: | ||
- /(fix|bug|bugfix)[:].+/ | ||
- label: 'documentation' | ||
branch: | ||
- /(documentation|doc|docs)[-/].+/ | ||
title: | ||
- /(documentation|doc|docs)[:].+/ | ||
files: | ||
- '*.rst' | ||
- label: 'style' | ||
branch: | ||
- /(style)[-/].+/ | ||
title: | ||
- /(style)[:].+/ | ||
- label: 'refactor' | ||
branch: | ||
- /(refactor)[-/].+/ | ||
title: | ||
- /(refactor)[:].+/ | ||
- label: 'ci' | ||
branch: | ||
- /(ci)[-/].+/ | ||
title: | ||
- /(ci)[:].+/ | ||
- label: 'chore' | ||
branch: | ||
- /(chore)[-/].+/ | ||
title: | ||
- /(chore)[:].+/ | ||
- label: 'refactor' | ||
branch: | ||
- /(refactor)[-/].+/ | ||
title: | ||
- /(refactor)[:].+/ | ||
- label: 'perf' | ||
branch: | ||
- /(perf|performance)[-/].+/ | ||
title: | ||
- /(perf|performance)[:].+/ | ||
- label: 'test' | ||
branch: | ||
- /(test|testing|tests)[-/].+/ | ||
title: | ||
- /(test|testing|tests)[:].+/ | ||
- label: 'build' | ||
branch: | ||
- /(build)[-/].+/ | ||
title: | ||
- /(build)[:].+/ | ||
- label: 'revert' | ||
branch: | ||
- /(revert)[-/].+/ | ||
title: | ||
- /(revert)[:].+/ | ||
- label: 'dependencies' | ||
branch: | ||
- /(dependencies|deps)[-/].+/ | ||
title: | ||
- /(dependencies|deps)[:].+/ | ||
- label: 'security' | ||
branch: | ||
- /(sec|security)[-/].+/ | ||
title: | ||
- /(sec|security)[:].+/ |
This file contains 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,60 @@ | ||
name: "Lint Pull Request Title" | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
- reopened | ||
|
||
permissions: | ||
pull-requests: read | ||
|
||
jobs: | ||
main: | ||
name: Validate Pull Request Title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/action-semantic-pull-request@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
# We modified this initial list: https://github.com/commitizen/conventional-commit-types | ||
# - feat: A new feature | ||
# - fix/bug: A bug fix | ||
# - docs/doc/documentation: Documentation only changes | ||
# - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) | ||
# - refactor: A code change that neither fixes a bug nor adds a feature | ||
# - perf: A code change that improves performance | ||
# - test/tests/testing: Adding missing tests or correcting existing tests | ||
# - build: Changes that affect the build system or external dependencies (example scopes: minimega, discovery) | ||
# - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) | ||
# - chore: Other changes that don't modify src or test files | ||
# - revert: Reverts a previous commit | ||
# - deps/dependencies: Changes that updates dependencies | ||
# - sec/security: Changes that impact security of the system | ||
# - deprecate: Changes that deprecate some feature | ||
types: | | ||
feat | ||
fix | ||
bug | ||
docs | ||
doc | ||
documentation | ||
style | ||
refactor | ||
perf | ||
test | ||
tests | ||
testing | ||
build | ||
ci | ||
chore | ||
revert | ||
deps | ||
dependencies | ||
sec | ||
security | ||
# Configure that a scope is not needed. | ||
requireScope: false |
This file contains 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,53 @@ | ||
name: Release Drafter | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- edited | ||
- synchronize | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
jobs: | ||
update_release_draft: | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
outputs: | ||
latest_version: ${{ steps.draft_release.outputs.tag_name }} | ||
release_notes: ${{ steps.draft_release.outputs.body }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Draft Release Notes | ||
id: draft_release | ||
uses: release-drafter/release-drafter@v6 | ||
with: | ||
publish: ${{ steps.check-version.outputs.tag != '' }} | ||
tag: ${{ steps.check-version.outputs.tag }} | ||
disable-autolabeler: false | ||
commitish: main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
pr-checker: | ||
name: Ensure Proper Pull Request Labels | ||
if: ${{ always() }} | ||
needs: update_release_draft | ||
permissions: | ||
pull-requests: read | ||
checks: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: danielchabr/[email protected] | ||
with: | ||
hasSome: feature,fix,style,changed,refactor,perf,test,build,ci,chore,revert,deprecated,removed,security,documentation,dependencies | ||
githubToken: ${{ secrets.GITHUB_TOKEN }} |
This file contains 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,33 @@ | ||
name: "Update Changelog" | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.release.target_commitish }} | ||
|
||
- name: Update Changelog | ||
uses: stefanzweifel/changelog-updater-action@v1 | ||
with: | ||
latest-version: ${{ github.event.release.tag_name }} | ||
release-notes: ${{ github.event.release.body }} | ||
compare-url-target-revision: ${{ github.event.release.target_commitish }} | ||
parse-github-usernames: true | ||
|
||
- name: Commit updated CHANGELOG | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
branch: ${{ github.event.release.target_commitish }} | ||
commit_message: 'docs(changelog): update changelog for version ${{ inputs.latest_version }}' | ||
file_pattern: CHANGELOG.md |
This file contains 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 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