Skip to content

Create too-many-fireworks-1.0.0.json #116

Create too-many-fireworks-1.0.0.json

Create too-many-fireworks-1.0.0.json #116

Workflow file for this run

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:
inputs:
pr_number:
description: "The PR number to check against"
default: ""
jobs:
# Single deploy job since we're just deploying
test:
name: pr-check-mods
runs-on: ubuntu-latest
steps:
- name: Set PR number
run: |
if [ "${{ github.event.pull_request.number }}" != "" ]; then
echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
fi
if [ "${{ github.event.client_payload.pr_number }}" != "" ]; then
echo "PR_NUMBER=${{ github.event.client_payload.pr_number }}" >> $GITHUB_ENV
fi
if [ "${{ github.event.inputs.pr_number }}" != "" ]; then
echo "PR_NUMBER=${{ github.event.inputs.pr_number }}" >> $GITHUB_ENV
fi
- name: Check PR number
run: |
if [ "$PR_NUMBER" == "" ]; then
echo "PR number not set"
false
fi
- 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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl --silent "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/files" | jq -r '.[].filename' > changed-files.txt
- name: Get the mods folder of the PR
id: download_mods_json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
rm -r mods
wget "https://api.github.com/repos/$GITHUB_REPOSITORY/tarball/pull/$PR_NUMBER/head" -qO - | tar -xzvf - --strip-components=1 --wildcards '*/mods/'
- name: Install npm modules
run: |
(cd source/scripts && npm install)
- name: Validate json
run: |
cd source/scripts
npx tsx ./pr-check.ts