|
| 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 |
0 commit comments