Skip to content

Commit 8dd1bc2

Browse files
committed
build: add workflow to lint PR titles
1 parent 7b6d5cd commit 8dd1bc2

File tree

4 files changed

+96
-2
lines changed

4 files changed

+96
-2
lines changed

.github/workflows/check_required_files.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ on:
3232
user:
3333
required: true
3434
type: string
35+
3536
# Define the secrets accessible by the workflow:
3637
secrets:
3738
STDLIB_BOT_GITHUB_TOKEN:

.github/workflows/do_not_merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ name: do_not_merge
2121

2222
# Workflow triggers:
2323
on:
24-
pull_request_target:
24+
pull_request:
2525
types:
2626
- synchronize
2727
- opened

.github/workflows/lint_pr_title.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2024 The Stdlib Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#/
18+
19+
# Workflow name:
20+
name: lint_pr_title
21+
22+
# Workflow triggers:
23+
on:
24+
pull_request:
25+
types:
26+
- synchronize
27+
- opened
28+
- reopened
29+
30+
# Global permissions:
31+
permissions:
32+
# Allow read-only access to the repository contents:
33+
contents: read
34+
35+
# Workflow jobs:
36+
jobs:
37+
38+
# Define a job for linting PR titles...
39+
lint_pr_title:
40+
41+
# Define a display name:
42+
name: 'Lint PR title'
43+
44+
# Define the type of virtual host machine:
45+
runs-on: ubuntu-latest
46+
47+
# Set defaults:
48+
defaults:
49+
run:
50+
# Set the default shell to `bash`:
51+
shell: bash --noprofile --norc -eo pipefail {0}
52+
53+
# Define the sequence of job steps...
54+
steps:
55+
56+
# Checkout the repository:
57+
- name: 'Checkout repository'
58+
# Pin action to full length commit SHA
59+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
60+
with:
61+
# Specify whether to remove untracked files before checking out the repository:
62+
clean: false
63+
64+
# Limit clone depth to the most recent 100 commits:
65+
fetch-depth: 100
66+
67+
# Specify whether to download Git-LFS files:
68+
lfs: false
69+
timeout-minutes: 10
70+
71+
# Install Node.js:
72+
- name: 'Install Node.js'
73+
# Pin action to full length commit SHA
74+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
75+
with:
76+
node-version: '20' # 'lts/*'
77+
timeout-minutes: 5
78+
79+
# Perform install sequence (accounting for possible network failures, etc, when installing node module dependencies):
80+
- name: 'Perform install sequence'
81+
run: |
82+
make install-node-modules || make install-node-modules || make install-node-modules
83+
timeout-minutes: 30
84+
85+
# Perform linting:
86+
- name: 'Perform linting'
87+
run: |
88+
echo "Pull request titles should follow stdlib's Git commit message conventions."
89+
echo "Linting pull request title..."
90+
make lint-commit-message GIT_COMMIT_MESSAGE="${{ github.event.pull_request.title }}"
91+
timeout-minutes: 5

.github/workflows/slash_commands.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ name: slash_commands
2222
# Workflow triggers:
2323
on:
2424
issue_comment:
25-
types: [created, edited]
25+
types:
26+
- created
27+
- edited
2628

2729
# Workflow jobs:
2830
jobs:

0 commit comments

Comments
 (0)