Semantic Pull Request
At VGV, we use conventional commits. This way, our commit history is clean and useful when we squash and merge — we can easily see the type and brief description of each PR. Note that this workflow can be customized to reflect the pull request types you want to enforce (e.g. feat, fix, docs, chore).
Steps
The semantic pull request package workflow consists of the following step:
- Ensure commit is semantic
Inputs
types
Optional Configure which types are allowed (e.g. "feat, fix, docs"
).
Note: If not set, then the action uses the list of Commitizen conventional commit types.
scopes
Optional Configure which scopes are allowed (e.g. "dart_package, flutter_package"
).
GitHub Repository Configuration
Squash Merging
To verify that this workflow will properly evaluate your pull request messages, we recommend configuring your GitHub repository to allow squash merging and setting the default commit message to "Pull request title."
GitHub Permissions
When running this workflow, the GITHUB_TOKEN
has to have the correct permissions to run successfully. On public repositories, the default settings grant the token enough permissions to run correctly. However, on private repositories, settings have to be updated. There are two ways of doing so:
-
Repository wide update. Inside your repository, go to Settings > Actions > General, scroll down to the Workflow permissions section and update it to allow Read and write permissions. Don't forget to save the changes.
-
Workflow specific update. In your workflow
yaml
file, you can modify the permissions for theGITHUB_TOKEN
. For this workflow to work you have to enable write permissions for pull requests in your job as follows.jobs:
build:
permissions:
pull-requests: write
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/semantic_pull_request.yml@v1You can read more about this in the github documentation.
Example Usage
name: My Workflow
on: pull_request
jobs:
build:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/semantic_pull_request.yml@v1