-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (50 loc) · 1.76 KB
/
Copy pathpr.yml
File metadata and controls
63 lines (50 loc) · 1.76 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
#
# GitHub Actions workflow.
#
# Perfoms the following actions on a pull request:
# * Lint the code
# * Run the tests
# * Confirm the build runs
#
name: PR Checks
on:
pull_request:
workflow_dispatch:
workflow_call:
jobs:
pr_checks:
name: 'Pull Request Package'
if: ${{ !contains(github.event.head_commit.message, '#skip-pr') }}
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT_TOKEN }}
- name: Export all inherited secrets to env
shell: bash
env:
# Produces a JSON object of all available secrets for this run (empty on forked PRs).
SECRETS_JSON: ${{ toJSON(secrets) }}
run: |
if [[ -z "$SECRETS_JSON" || "$SECRETS_JSON" == "{}" ]]; then
echo "No secrets available (forked PRs do not receive repository secrets)."
exit 0
fi
echo "$SECRETS_JSON" \
| jq -r 'to_entries[]
| select(.key | test("^[A-Za-z_][A-Za-z0-9_]*$"))
| "\(.key)=\(.value)"' >> "$GITHUB_ENV"
echo "Exported secrets to env for this job."
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 24
- name: Install dependencies
run: npm install
- name: Lint
run: npm run lint
- name: Test
run: npm run test
- name: Build
run: npm run build