-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👷 add workflow to check if PR title starts with gitm😍ji (#3013)
- Loading branch information
1 parent
05b79ca
commit fa586b0
Showing
1 changed file
with
23 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Check if PR title starts with a Gitmoji | ||
|
||
on: | ||
pull_request: | ||
types: [ opened, edited, synchronize ] | ||
|
||
jobs: | ||
check-title: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check if PR title starts with emoji or emoji string | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const title = context.payload.pull_request.title; | ||
const emojiRegex = /^[\u{1F300}-\u{1F6FF}\u{1F900}-\u{1F9FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}]/u; | ||
const emojiStringRegex = /^:\w+:/; | ||
if (!emojiRegex.test(title) && !emojiStringRegex.test(title)) { | ||
core.setFailed('The PR title must start with a Gitmoji! See here: https://gitmoji.dev/'); | ||
} | ||
console.log('PR title starts with a Gitmoji! 🎉'); |