mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
ci(conventional-commit-check): run checks on being added to queue (#1152)
This commit is contained in:
20
.github/workflows/conventional-commit-check.yml
vendored
20
.github/workflows/conventional-commit-check.yml
vendored
@ -8,9 +8,13 @@ on:
|
||||
- reopened
|
||||
- ready_for_review
|
||||
|
||||
merge_group:
|
||||
types:
|
||||
- checks_requested
|
||||
|
||||
permissions:
|
||||
# Reference: https://github.com/cli/cli/issues/6274
|
||||
repository-projects: read
|
||||
repository-projects: write
|
||||
pull-requests: write
|
||||
|
||||
env:
|
||||
@ -35,6 +39,7 @@ jobs:
|
||||
|
||||
- uses: Swatinem/rust-cache@v2.2.0
|
||||
with:
|
||||
key: "pr_title_check"
|
||||
cache-on-failure: "true"
|
||||
|
||||
- name: Install cocogitto
|
||||
@ -43,13 +48,22 @@ jobs:
|
||||
|
||||
- name: Verify PR title follows conventional commit standards
|
||||
id: pr_title_check
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
run: cog verify "${{ github.event.pull_request.title }}"
|
||||
|
||||
- name: Verify commit message follows conventional commit standards
|
||||
id: commit_message_check
|
||||
if: ${{ github.event_name == 'merge_group' }}
|
||||
shell: bash
|
||||
# Fail on error, we don't have context about PR information to update labels
|
||||
continue-on-error: false
|
||||
run: cog verify "${{ github.event.merge_group.head_commit.message }}"
|
||||
|
||||
# GitHub CLI returns a successful error code even if the PR has the label already attached
|
||||
- name: Attach 'S-conventions-not-followed' label if PR title check failed
|
||||
if: ${{ steps.pr_title_check.outcome == 'failure' }}
|
||||
if: ${{ github.event_name == 'pull_request' && steps.pr_title_check.outcome == 'failure' }}
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
@ -60,7 +74,7 @@ jobs:
|
||||
|
||||
# GitHub CLI returns a successful error code even if the PR does not have the label attached
|
||||
- name: Remove 'S-conventions-not-followed' label if PR title check succeeded
|
||||
if: ${{ steps.pr_title_check.outcome == 'success' }}
|
||||
if: ${{ github.event_name == 'pull_request' && steps.pr_title_check.outcome == 'success' }}
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
Reference in New Issue
Block a user