-
Notifications
You must be signed in to change notification settings - Fork 15
84 lines (82 loc) · 2.86 KB
/
validateAllAddons.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Check all submitted NVDA add-ons
on:
workflow_dispatch:
schedule:
# perform once a month at the very start of the month
- cron: '0 0 1 * *'
jobs:
checkMetadata:
permissions:
contents: write
pull-requests: write
runs-on: windows-latest
strategy:
matrix:
python-version: [ 3.11 ]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.headRef }}
- name: Create validation errors file
run: echo "" > validationErrors.md
- name: Install addon download validation dependencies
run: npm install glob uuid
- name: Delete add-ons with invalid downloads
if: always()
id: deleteInvalidDownloads
uses: actions/github-script@v7
with:
script: |
const checkAddonUrlAndHash = require('./.github/workflows/checkAddonUrlAndHash.js')
checkAddonUrlAndHash({core}, "./addons/*/*.json")
- name: Create PR for deleting invalid downloads
if: always()
uses: peter-evans/create-pull-request@v6
with:
title: Delete add-ons with invalid downloads
branch: delInvalidDownloads${{ github.run_number }}
commit-message: Delete invalid add-ons
body: "${{ steps.deleteInvalidDownloads.outputs.PRBodyString }}"
author: github-actions <[email protected]>
add-paths: 'addons/*/*.json'
- name: Normalize JSON files with jq
shell: bash
run: |
for file in ./addons/*/*.json; do
jq --tab . "${file}" > "${file}.tmp"
mv "${file}.tmp" "${file}"
done
- name: Create PR for normalizing files
if: always()
uses: peter-evans/create-pull-request@v6
with:
title: Normalize JSON files
branch: normJSON${{ github.run_number }}
commit-message: Normalize JSON files
body: "Use tabs and unicode encoding for JSON files"
author: github-actions <[email protected]>
add-paths: 'addons/*/*.json'
- name: Checkout validate repo
uses: actions/checkout@v4
with:
repository: nvaccess/addon-datastore-validation
path: validation
submodules: true
- name: Install addon-datastore-validation dependencies
run: |
python -m pip install --upgrade wheel
pip install -r validation/requirements.txt
- name: Checkout transformation repo for nvdaAPIVersions.json
uses: actions/checkout@v4
with:
repository: nvaccess/addon-datastore-transform
path: transform
- name: Validate all add-ons metadata
run: validation/runvalidate ./addons/*/*.json ./transform/nvdaAPIVersions.json --output ./validationErrors.md
- name: Upload validation errors as artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: validationErrors
path: ./validationErrors.md