Skip to content

Commit a757fb3

Browse files
authored
build: add workflow to validate local dev setup via commit metadata
PR-URL: #5696 Closes: stdlib-js/metr-issue-tracker#46 Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent 11e8a56 commit a757fb3

File tree

2 files changed

+469
-0
lines changed

2 files changed

+469
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2025 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: check_commit_metadata
21+
22+
# Workflow triggers:
23+
on:
24+
# Trigger on pull request events:
25+
pull_request_target:
26+
types:
27+
- opened
28+
29+
# Global permissions:
30+
permissions:
31+
# Allow read-only access to the repository contents:
32+
contents: read
33+
34+
# Workflow jobs:
35+
jobs:
36+
37+
# Define a job for checking the commit metadata for whether local development is properly setup...
38+
check_commit_metadata:
39+
40+
# Define a display name:
41+
name: 'Check Commit Metadata'
42+
43+
# Define the type of virtual host machine:
44+
runs-on: ubuntu-latest
45+
46+
# Skip this job for PRs opened by automated bot accounts:
47+
if: github.event.pull_request.user.login != 'stdlib-bot' && github.event.pull_request.user.login != 'dependabot[bot]'
48+
49+
# Define the sequence of job steps...
50+
steps:
51+
# Checkout the repository:
52+
- name: 'Checkout repository'
53+
# Pin action to full length commit SHA
54+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
55+
with:
56+
# Specify whether to remove untracked files before checking out the repository:
57+
clean: true
58+
59+
# Limit clone depth to the most recent commit:
60+
fetch-depth: 1
61+
62+
# Specify whether to download Git-LFS files:
63+
lfs: false
64+
timeout-minutes: 10
65+
66+
# Extract commit metadata from commit messages as JSON:
67+
- name: 'Extract commit metadata'
68+
id: extract-metadata
69+
uses: stdlib-js/metadata-action@v2
70+
71+
# Check commit metadata:
72+
- name: 'Check commit metadata'
73+
env:
74+
PR_NUMBER: ${{ github.event.pull_request.number }}
75+
COMMIT_METADATA: ${{ steps.extract-metadata.outputs.metadata }}
76+
GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_PAT_REPO_WRITE }}
77+
run: |
78+
. "$GITHUB_WORKSPACE/.github/workflows/scripts/check_commit_metadata" $PR_NUMBER $COMMIT_METADATA

0 commit comments

Comments
 (0)