Skip to content

Commit

Permalink
ci: Add conventional commit check for PRs (Unity-Technologies#497)
Browse files Browse the repository at this point in the history
- PR titles are verified against the conventional commit standard (angular) types (fix, feat, chore, etc.)
- Single-commit PRs have their commit title checked against the standard types, as github uses this commit title instead of PR title by default
- Github Action trigger is configured for pull requests targeting master and develop branches, but master won't take effect until this change is merged to that branch
  • Loading branch information
JesseOlmer authored Feb 25, 2021
1 parent 897930c commit a950848
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/conventional-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Conventional PR

# Controls when the action will run.
on:
pull_request:
branches:
- master
- develop

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: semantic-pull-request
# Internal Unity mirror available at jesseo/action-semantic-pull-request, but actions from private repos aren't supported, so continue to use the public one below
uses: amannn/action-semantic-pull-request@b7a9a97cb10fa6e1ae02647e718798175f6b1f1d
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Provide custom types if you don't want the default ones from https://www.conventionalcommits.org
types: # optional
# Configure which scopes are allowed.
#scopes: # optional
# Configure that a scope must always be provided.
#requireScope: # optional
# Configure additional validation for the subject based on a regex. E.g. '^(?![A-Z]).+$' ensures the subject doesn't start with an uppercase character.
#subjectPattern: # optional
# If `subjectPattern` is configured, you can use this property to override the default error message that is shown when the pattern doesn't match. The variables `subject` and `title` can be used within the message.
#subjectPatternError: # optional
# For work-in-progress PRs you can typically use draft pull requests from Github. However, private repositories on the free plan don't have this option and therefore this action allows you to opt-in to using the special '[WIP]' prefix to indicate this state. This will avoid the validation of the PR title and the pull request checks remain pending. Note that a second check will be reported if this is enabled.
#wip: # optional
# When using "Squash and merge" on a PR with only one commit, GitHub will suggest using that commit message instead of the PR title for the merge commit, and it's easy to commit this by mistake. Enable this option to also validate the commit message for one commit PRs.
validateSingleCommit: true # optional

0 comments on commit a950848

Please sign in to comment.