Skip to content

Commit

Permalink
ci: separates pr title linter from the other workflow so it only runs…
Browse files Browse the repository at this point in the history
… on pr edit
  • Loading branch information
ctran88 committed Oct 28, 2024
1 parent 98bfff5 commit 9e57712
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 26 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,3 @@ jobs:
run: go test ./...
- name: Test with race detector
run: go test -race -run TestAppJWKSCacheWriteConcurrency
lint-pr-title:
name: Lint PR Title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
Please update the pull request title to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/).
Details:
```
${{ steps.lint_pr_title.outputs.error_message }}
```
# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true
34 changes: 34 additions & 0 deletions .github/workflows/pr-title-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: PR Title Check

on:
pull_request:
types:
- edited

jobs:
lint-pr-title:
name: Lint PR Title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
Please update the pull request title to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/).
Details:
```
${{ steps.lint_pr_title.outputs.error_message }}
```
# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true

0 comments on commit 9e57712

Please sign in to comment.