-
Notifications
You must be signed in to change notification settings - Fork 9
54 lines (44 loc) · 2 KB
/
main.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
name: validate
on: [push, pull_request, pull_request_target, workflow_dispatch]
jobs:
build:
if: (github.event_name == 'push' && github.ref_name == github.event.repository.default_branch) || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository)
runs-on: ubuntu-latest
env:
G_SAFE_BROWSING_API_KEY: ${{ secrets.G_SAFE_BROWSING_API_KEY }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm install
- name: test scripts
run: npm test
- name: validate registries
run: npm run validate
- name: verify that the registries are canonicalized
if: (github.ref == 'refs/heads/master' || github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.actor != 'dependabot[bot]'
run: |
npm run canonicalize
git add src/main/data
git diff-index --quiet HEAD src/main/data
- name: commit canonicalized registries
if: github.ref != 'refs/heads/master' && github.event_name != 'pull_request' && github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]'
run: |
npm run canonicalize
git add src/main/data
git config --global user.name 'ISDCF Registries Canonicalizer'
git config --global user.email '[email protected]'
git diff-index --quiet HEAD src/main/data || git commit -m "Registries have been canonicalized"
git push
- name: Repository Dispatch
if: github.ref == 'refs/heads/master'
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.REGISTRIES_SITE_PAT }}
repository: isdcf/registries-site
event-type: build-site