-
Notifications
You must be signed in to change notification settings - Fork 8
63 lines (54 loc) · 1.84 KB
/
validate.yml
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
name: Validate newly added JSON
on:
pull_request:
types:
- opened
- ready_for_review
- reopened
- synchronize
paths:
- records/new/*.json
permissions:
contents: read
jobs:
validate-json:
# Only run if the PR is from a branch in the main repo, otherwise skip it.
# There can be a separate, local validation that runs for PRs from forks.
# https://github.com/nodejs/bluesky/issues/10
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
ref: refs/pull/${{ github.event.pull_request.number }}/merge
persist-credentials: false
# Must be done before setup-node.
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "yarn"
cache-dependency-path: actions/yarn.lock
- name: Install Dependencies
run: yarn install --frozen-lockfile
working-directory: ./actions
- name: Find newly added JSON files
id: find-json
run: |
# Get the list of added JSON files in the records/new/ directory
ADDED_FILES=$(git diff HEAD^..HEAD --diff-filter=A --name-only records/new | grep '/.*\.json$' || true)
echo "NEW_JSON_FILES=$ADDED_FILES" >> "$GITHUB_ENV"
- name: Validate files
if: env.NEW_JSON_FILES
env:
BLUESKY_IDENTIFIER_NODEJS_ORG: nodejs.org
BLUESKY_APP_PASSWORD_NODEJS_ORG: ${{ secrets.BLUESKY_APP_PASSWORD_NODEJS_ORG }}
run: |
for file in $NEW_JSON_FILES; do
echo "Processing $file..."
node actions/login-and-validate.js "$file"
done