Skip to content

Commit

Permalink
ci: Update workflows
Browse files Browse the repository at this point in the history
Update the standard workflows to match the latest internal template.
  • Loading branch information
Wuestengecko committed Jul 10, 2024
1 parent fa5ba70 commit 0f40cd7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
34 changes: 20 additions & 14 deletions .github/workflows/commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ on:
jobs:
conventional-commits:
runs-on: ubuntu-latest
concurrency:
group: commit-check-pr-${{ github.event.pull_request.number }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install commitlint
run: npm install -g @commitlint/cli @commitlint/config-conventional
run: npm install @commitlint/cli @commitlint/config-conventional
- name: Validate commit messages
id: conventional-commits
env:
Expand All @@ -25,14 +28,25 @@ jobs:
delim="_EOF_$(uuidgen)"
echo "validation-result<<$delim" >> "$GITHUB_OUTPUT"
r=0
commitlint --from "$SHA_FROM" --to "$SHA_TO" >> "$GITHUB_OUTPUT" 2>&1 || r=$?
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
if: steps.conventional-commits.outcome == 'failure'
uses: actions/github-script@v7
env:
TEXT: |-
uses: peter-evans/create-or-update-comment@v4
if: always() && steps.conventional-commits.outcome == 'failure'
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
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 [Contributing guidelines](https://github.com/DSD-DBS/py-capellambse/blob/master/CONTRIBUTING.rst#quality-controls). This will run all the important checks right before you commit your changes, and avoids lengthy CI wait time and round trips.
Expand All @@ -47,11 +61,3 @@ jobs:
fix(aird): Prevent creating circles with r=0
docs(readme): Update project description
```
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.TEXT
})
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
name: Docs

on:
workflow_dispatch:
pull_request:
push:
branches: [master]
pull_request:
workflow_dispatch:

jobs:
sphinx:
Expand Down

0 comments on commit 0f40cd7

Please sign in to comment.