Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

[WEAV-30] Add PR title validation workflow #4

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/pr-title-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: PR title validation

on:
pull_request:
branches:
- main

permissions:
pull-requests: write

jobs:
pr-title-validation:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: check pr title format
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const pull_number = context.issue.number
const owner = context.repo.owner
const repo = context.repo.repo

const { data: pull } = await github.rest.pulls.get({
owner,
repo,
pull_number,
})

const titlePattern = /^\[WEAV-\d+\]/

if (!titlePattern.test(pull.title)) {
core.setFailed('PR 제목이 `[WEAV-번호]` 형식을 따르지 않습니다.')
return
}

// PR 제목이 형식을 따르면 아무 조치도 취하지 않음