-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (38 loc) · 1.21 KB
/
Copy pathsemantic-git-message.yml
File metadata and controls
42 lines (38 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
on:
workflow_call:
permissions:
contents: read
jobs:
calculate-depth:
name: Calculate commits in the PR
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
calculated_depth: ${{ steps.calc.outputs.depth }}
steps:
- name: Compute the required fetch_depth
id: calc
run: |
PR_COMMITS=${{ github.event.pull_request.commits }}
if [ -z "$PR_COMMITS" ]; then
echo "Not a PR event. Using default fetch_depth of 1"
REQUIRED_DEPTH=1
else
echo "PR event detected with $PR_COMMITS commits"
REQUIRED_DEPTH=$((PR_COMMITS + 1))
fi
echo "depth=$REQUIRED_DEPTH" >> $GITHUB_OUTPUT
validate-semantic-commits:
name: Validate semantic commits
runs-on: ubuntu-latest
needs: calculate-depth
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: ${{ needs.calculate-depth.outputs.calculated_depth }}
- name: Validate commit messages
uses: webiny/action-conventional-commits@7f91b1595ca1951cdb671ddc9f07a49081ec5b69 # v1.4.2