Repository navigation
90 lines (86 loc) · 3.02 KB
/
Copy pathlint-pull-request.yml
File metadata and controls
90 lines (86 loc) · 3.02 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Lint Pull Request
# Release-notes PRs (head ref `release-notes/*`) skip CI; only
# apply-release-notes.yml runs for those.
#
# Draft PRs skip this check unless they carry `run-ci` (same opt-in as Test).
# Label events retrigger this cheap check so adding `run-ci` on a draft starts
# lint without waiting for a push.
on:
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened
- ready_for_review
- labeled
- unlabeled
merge_group:
types:
- checks_requested
branches:
- develop
- next
permissions:
contents: read
pull-requests: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
main:
if: |
github.event_name == 'merge_group' ||
(github.event_name == 'pull_request_target' &&
!startsWith(github.event.pull_request.head.ref, 'release-notes/') &&
(github.event.pull_request.draft == false ||
contains(github.event.pull_request.labels.*.name, 'run-ci')))
name: Lint Pull Request
runs-on: ubuntu-latest
steps:
- if: github.event_name == 'pull_request_target'
uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Keep this scope list in sync with commitlint.config.js.
with:
scopes: |
api
cli
cli-e2e
cli-go
cli-test-helpers
config
docs
process-compose
stack
ci
deps
repo
misc
release
- if: github.event_name == 'merge_group'
run: echo "Merge queue entry does not have a pull request payload; reporting success for the required lint check."
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.repository.default_branch }}
sparse-checkout: |
.github/scripts
apps/cli/scripts/analyze-commits-title.js
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version-file: .bun-version
- name: Breaking titles target next
env:
TITLE: ${{ github.event_name == 'merge_group' && github.event.merge_group.head_commit.message || github.event.pull_request.title }}
BASE_REF: ${{ github.event_name == 'merge_group' && github.event.merge_group.base_ref || github.event.pull_request.base.ref }}
HEAD_REF: ${{ github.event.pull_request.head.ref }}
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
BASE_REPO: ${{ github.repository }}
run: |
if [ -f .github/scripts/pr-title-guard.ts ]; then
bun .github/scripts/pr-title-guard.ts
else
echo "::notice::pr-title-guard.ts is not on the default branch yet; skipping"
fi