Skip to content

Commit

Permalink
Add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyvest committed Jul 4, 2024
1 parent 85a2f43 commit b4b39b9
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
55 changes: 55 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Format (or check) JSON

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: "*"
pull_request:
branches: "*"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
format_json:
name: Format JSON
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Configure git
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Grab Node.js
uses: actions/setup-node@v3
with:
node-version: "16.x"
- name: Install dependencies
run: |
npm install -g prettier jsonschema-cli
- name: Check mods file is valid
run: |
validateJson -d files/mods.json -s mod_schema.json
- name: Check Prettier
run: |
npx prettier **/*.json --check
if: ${{ github.event_name != 'push' }}
- name: Run Prettier
run: |
npx prettier **/*.json --write
if: ${{ github.event_name == 'push' }}
- name: Commit
run: |
#!/bin/bash
set +e
git commit -am "Automatically prettify json"
set -e
if: ${{ github.event_name == 'push' }}
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
if: ${{ github.event_name == 'push' }}

0 comments on commit b4b39b9

Please sign in to comment.