-
Notifications
You must be signed in to change notification settings - Fork 56
70 lines (70 loc) · 2.13 KB
/
policy.yaml
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
---
name: policy
on:
pull_request:
push:
branches:
# This is run on merge queue branches as there are jobs listed in this
# action that are often required in branch protection rules. Due to guards
# below certain jobs may not run in merge queue branches but will still
# return a status indicating a pass.
- gh-readonly-queue/**
- master
jobs:
check-merge-commits:
if: github.event_name == 'pull_request'
name: Check merge commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |
git config --global --add safe.directory /github/workspace
merge_commits=$(git rev-list --merges "origin/$GITHUB_BASE_REF".."origin/$GITHUB_HEAD_REF")
if [ -n "$merge_commits" ]; then
echo "Error: merge commits found in $GITHUB_BASE_REF..$GITHUB_HEAD_REF"
for merge_commit in $merge_commits; do
echo "$merge_commit"
done
exit 1
fi
commit-message-style:
if: github.event_name == 'pull_request' && github.triggering_actor != 'dependabot[bot]'
name: Check commit message style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 19.x
- name: Install base config
run: npm install @commitlint/config-conventional
- name: Validate commit messages
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to HEAD --verbose
markdown-style:
name: Check markdown style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 19.x
- name: Validate markdown
run: npx markdownlint-cli2 **/*.md "#docs/**/*.md"
yaml-style:
name: Check YAML style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install yamllint
run: pip install --user yamllint
- name: Validate YAML
run: yamllint .