Skip to content

Commit

Permalink
👷 add workflow to check if PR title starts with gitm😍ji
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKrisKrisu committed Nov 30, 2024
1 parent f356e99 commit 5b36b9c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/check-pr-title.yml
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! 🎉');

0 comments on commit 5b36b9c

Please sign in to comment.