-
Notifications
You must be signed in to change notification settings - Fork 2
72 lines (63 loc) · 2.34 KB
/
workflow_call.commitlint.yml
File metadata and controls
72 lines (63 loc) · 2.34 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Copyright 2025 Ian Lewis
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: commitlint
on:
workflow_call:
inputs:
from_ref:
type: string
required: false
default: ${{ github.event.pull_request.base.sha }}
to_ref:
type: string
required: false
default: ${{ github.event.pull_request.head.sha }}
permissions:
contents: read
concurrency:
group: commitlint-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
commitlint:
name: commitlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0 # Fetch all history for all branches and tags
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version-file: ".node-version"
# NOTE: actions/checkout does not set up local branches
- run: |
# Fetch the HEAD ref. This is necessary to get the correct default
# branch.
git remote set-head origin --auto
# Create local branches for all remote branches except pull requests.
set -euo pipefail
current_branch=$(git rev-parse --abbrev-ref HEAD)
for remote_branch in $(git branch -r | grep -v "\->" | grep -v -e "^\s*pull/"); do
local_branch=$(echo "${remote_branch}" | sed 's/origin\///')
if [[ "${local_branch}" == "${current_branch}" ]]; then
continue
fi
git branch --track "${local_branch}" "${remote_branch}"
done
- name: commitlint
env:
COMMITLINT_FROM_REF: ${{ inputs.from_ref }}
COMMITLINT_TO_REF: ${{ inputs.to_ref }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make commitlint