Skip to content

Commit

Permalink
add dev and pr name check workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jbigel committed Jul 26, 2024
1 parent dd8ed34 commit dcf24da
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/dev-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Dev Release to GitHub
on:
push:
branches:
- 'dev'
workflow_dispatch:

jobs:
release:
name: Release
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn install
- name: Release to GitHub
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_BOT_PAT }} # <-- Allows semantic-release-bot to push changes to protected branches (using a PAT to avoid rate limits)
npm_config_tag: dev # <-- See ./.releaserc for release branch config.
run: npx semantic-release
38 changes: 38 additions & 0 deletions .github/workflows/pr-name-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: PR Name Check

on:
pull_request:
branches:
- 'dev'
types: [opened, edited, synchronize]

jobs:
check-pr-name:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2

- name: Check PR title
run: |
if ! echo "${{ github.event.pull_request.title }}" | grep -Eq "^(feat|fix|BREAKING CHANGE)(\([^)]+\))?: "; then
echo 'FAIL_OUTPUT=Invalid PR title. It must start with feat: or fix: or BREAKING CHANGE: or feat(<DESCRIPTOR>): or fix(<DESCRIPTOR>): or BREAKING CHANGE(<DESCRIPTOR>):' >> $GITHUB_ENV
exit 1
fi
- name: Comment on PR
if: failure()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_COMMENT: ${{ env.FAIL_OUTPUT }}
run: |
JSON_PAYLOAD=$(jq -n --arg body "$PR_COMMENT" '{"body": $body}')
echo "Generated JSON payload:"
echo "$JSON_PAYLOAD"
curl -X POST \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"

0 comments on commit dcf24da

Please sign in to comment.