@@ -37,11 +37,13 @@ spec:
3737 value : " $(params.repo_url)"
3838 - name : revision
3939 value : " $(params.revision)"
40+ - name : depth
41+ value : 1000
4042 - name : generate-release-yaml
4143 image : registry.access.redhat.com/ubi9/python-312
4244 workingDir : $(workspaces.source.path)
4345 script : |
44- set -x
46+ set -euxo pipefail
4547 mkdir -p bin/ # ignored in .gitignore
4648 ./hack/generate-releaseyaml.sh > bin/release.yaml
4749 - name : codespell
6163 image : registry.access.redhat.com/ubi9/python-312
6264 workingDir : $(workspaces.source.path)
6365 script : |
64- set -x
66+ set -euxo pipefail
6567 if [[ "{{ headers['X-Github-Event'] }}" == "" ]]; then
6668 echo "Not a GitHub event, skipping gitlint"
6769 exit 0
@@ -75,14 +77,62 @@ spec:
7577 git config --global --add safe.directory $(workspaces.source.path)
7678 git log -1 --format=format:%s |grep -E -q '^Merge branch' && exit 0
7779 pip3 install gitlint
78- gitlint --commit "$(git log --format=format:%H --no-merges -1)" --ignore "Merge branch"
80+
81+ # Check all commits between base_sha and HEAD
82+ base_sha="{{ body.pull_request.base.sha }}"
83+ failed=0
84+ while read -r commit_hash; do
85+ echo "Checking commit: $commit_hash"
86+ if ! gitlint --commit "$commit_hash" --ignore "Merge branch"; then
87+ failed=1
88+ fi
89+ done < <(git log "${base_sha}..HEAD" --format=format:%H --no-merges)
90+
91+ exit $failed
92+
93+ - name : conventional-commits
94+ displayName : " conventional commit check"
95+ image : registry.access.redhat.com/ubi9/python-312
96+ workingDir : $(workspaces.source.path)
97+ script : |
98+ set -euxo pipefail
99+ git config --global --add safe.directory /workspace/source
100+
101+ if [[ "{{ headers['X-Github-Event'] }}" == "" ]]; then
102+ echo "Not a GitHub event, skipping gitlint"
103+ exit 0
104+ fi
105+
106+ if [[ "{{ headers['X-Github-Event'] }}" != "pull_request" ]]; then
107+ echo "Not a pull request, skipping gitlint"
108+ exit 0
109+ fi
110+ base_sha="{{ body.pull_request.base.sha }}"
111+
112+ # make sure we have a conventional commit
113+ invalid_commits=0
114+ while read -r commit_msg; do
115+ if ! echo "$commit_msg" | grep -E -q '^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([a-z0-9-]+\))?:'; then
116+ echo "ERROR: Found commit message that does not follow conventional commit format:"
117+ echo "$commit_msg"
118+ invalid_commits=$((invalid_commits + 1))
119+ fi
120+ done < <(git log "${base_sha}..HEAD" --format=format:%s --no-merges)
121+
122+ if [ $invalid_commits -gt 0 ]; then
123+ echo "ERROR: $invalid_commits commit(s) do not follow conventional commit format."
124+ echo "Expected format: type(scope): description"
125+ echo "Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert"
126+ echo "See: https://www.conventionalcommits.org/en/v1.0.0/#summary"
127+ exit 1
128+ fi
79129
80130 - name : yamllint
81131 displayName : " YAML Linter"
82132 image : cytopia/yamllint
83133 workingDir : $(workspaces.source.path)
84134 script : |
85- set -x
135+ set -euxo pipefail
86136 yamllint -f parsable -c .yamllint $(find . -type f -regex ".*y[a]ml" -print)
87137
88138 - name : ruff-lint
0 commit comments