Skip to content

Create DrinkWater-0.2.0.json #53

Create DrinkWater-0.2.0.json

Create DrinkWater-0.2.0.json #53

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: ""
repository_dispatch:
types: [trigger_deploy]
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
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
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 scripts
npm install
cd ../website
npm install
- name: Validate json
run: |
cd scripts
npx tsx ./pr-check.ts