diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..8599c7b --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,27 @@ +name: Your workflow +on: + pull_request: + types: [opened, reopened, synchronize, edited] + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Validate Title + uses: FidelusAleksander/gh-action-regex@v0.3.0 + with: + regex_pattern: "^(feat|fix|docs|style|refactor|perf|test|build|ci)\\(\\w+\\):\\s.+" + text: ${{ github.event.pull_request.title }} + + - name: Return message on pull request if validation fails + uses: actions/github-script@v4 + with: + script: | + if (steps.Validate_Title.conclusion === 'failure') { + const pr = context.payload.pull_request; + await github.pulls.createComment(pr.number, { + body: `**Pull request title does not match the required format.** + \ No newline at end of file diff --git a/README.md b/README.md index d5ff03c..99411eb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ # test -Test sample 7 +Test sample 12 +