Validate Mod Json #50
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Validate Mod Json | |
on: | |
# Runs on pushes targeting the default branch | |
pull_request: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
# Single deploy job since we're just deploying | |
test: | |
name: pr-check-mods | |
runs-on: ubuntu-latest | |
if: (github.event.issue.pull_request && github.event_name == 'issue_comment' && github.event.comment.body == '/check') || github.event_name == 'pull_request' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Get changed files | |
id: get_changed_files | |
run: | | |
curl --silent "https://api.github.com/repos/dantheman827/bsqmods/pulls/${{ github.event.pull_request.number }}/files" | jq -r '.[].filename' > changed-files.txt | |
- name: Get the mods folder of the PR | |
id: download_mods_json | |
run: | | |
rm -r mods | |
wget "https://api.github.com/repos/dantheman827/bsqmods/tarball/pull/${{ github.event.pull_request.number }}/head" -qO - | tar -xzvf - --strip-components=1 --wildcards '*/mods/' | |
- name: Install npm modules | |
run: | | |
cd scripts | |
npm install | |
cd ../website | |
npm install | |
- name: Validate json | |
run: | | |
cd scripts | |
npx tsx ./pr-check.ts |