This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / .tangled / workflows / commit-lint.yml
1.2 kB 40 lines
1when: 2 - event: ["push", "pull_request"] 3 branch: master 4 5engine: microvm 6image: nixos 7 8dependencies: 9 - git 10 - bash 11 12# The default clone is depth 1 (single SHA), which is enough for a push but not 13# for computing a pull-request commit range. Fetch some history so we can find 14# the merge-base with the target branch. 15clone: 16 depth: 100 17 18steps: 19 - name: lint commit messages 20 command: | 21 set -eu 22 lint=.tangled/hooks/commit-msg-lint.sh 23 chmod +x "$lint" 24 25 kind="${TANGLED_PIPELINE_KIND:-push}" 26 head="${TANGLED_COMMIT_SHA:-HEAD}" 27 28 # For a pull request, lint every commit between the target branch and the 29 # PR head. For a push, only the tip SHA is known, so lint just that. 30 if [ "$kind" = "pull_request" ]; then 31 base_branch="${TANGLED_PR_TARGET_BRANCH:-${TANGLED_REPO_DEFAULT_BRANCH:-master}}" 32 git fetch --depth=100 origin "$base_branch" 33 base="$(git merge-base FETCH_HEAD "$head" || true)" 34 if [ -n "$base" ]; then 35 exec "$lint" --range "$base" "$head" 36 fi 37 echo "commit-lint: no merge-base with $base_branch; linting tip only" >&2 38 fi 39 40 exec "$lint" --rev "$head"