Skip to content

Commit

Permalink
Merge pull request #1747 from DSD-DBS/replace-gh-comment
Browse files Browse the repository at this point in the history
ci: Replace existing commitlint PR comments
  • Loading branch information
MoritzWeber0 authored Sep 4, 2024
2 parents 3f614f8 + 769d181 commit 2ee1184
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions .github/workflows/commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
conventional-commits:
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]'
concurrency:
group: commit-check-pr-${{ github.event.pull_request.number }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -29,11 +32,21 @@ jobs:
npx commitlint --from "$SHA_FROM" --to "$SHA_TO" >> "$GITHUB_OUTPUT" 2>&1 || r=$?
echo "$delim" >> "$GITHUB_OUTPUT"
exit $r
- name: Find conventional commit comment on PR
uses: peter-evans/find-comment@v3
if: always() && steps.conventional-commits.outcome == 'failure'
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: conventional commit
- name: Post comment if validation failed
uses: peter-evans/create-or-update-comment@v4
if: always() && steps.conventional-commits.outcome == 'failure'
uses: actions/github-script@v7
env:
TEXT: |-
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
The pull request does not conform to the conventional commit specification. Please ensure that your commit messages follow the spec: <https://www.conventionalcommits.org/>.
We also strongly recommend that you set up your development environment with pre-commit, as described in our [Developer documentation](https://dsd-dbs.github.io/capella-collab-manager/development/). This will run all the important checks right before you commit your changes, and avoids lengthy CI wait time and round trips.
Expand All @@ -48,11 +61,4 @@ jobs:
docs(user): Add model creation workflow
feat: Add a monitoring dashboard
```
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.TEXT
})
edit-mode: replace

0 comments on commit 2ee1184

Please sign in to comment.