Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/actions/fix-stuff/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Fix Formatting & Generate UUIDs
description: Fixes formatiting, generates missing UUUIDs and commits changes

outputs:
changes_detected:
description: Whether any changes were detected after formatting and generating UUIDs
value: ${{ steps.commit-changes.outputs.changes_detected }}

runs:
using: composite
steps:
- uses: ./.github/actions/setup

- name: Format Code
shell: bash
run: npm run format

- name: Generate UUIDs
shell: bash
run: npm run gen:uuids

- name: Commit Formatted Code & Generated UUIDs
id: commit-changes
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_user_name: osrs-taskbot
commit_user_email: r.mobis+taskbot@gmail.com
commit_message: "[skip-fix] format everything and generate missing UUIDs"
165 changes: 165 additions & 0 deletions .github/workflows/fix-and-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
name: Fix & Lint

on:
pull_request:
branches: ["main"]

jobs:
check-sensitive:
name: Check for Sensitive Files
runs-on: ubuntu-latest

outputs:
require_approval: ${{ steps.changed-sensitive.outputs.any_changed || false }}
skip_fix: ${{ contains(steps.skip-fix.outputs.commit_message, 'skip-fix') }}

steps:
- name: Checkout Repository
uses: actions/checkout@v7
with:
fetch-depth: 2

- name: Check Changed Sensitive Files
id: changed-sensitive
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
uses: tj-actions/changed-files@v47
with:
files: |
.github/**
package*.json
**.mts
lefthook.yml

- name: Get Latest Commit Message
id: skip-fix
run: |
echo 'commit_message<<EOF' >> $GITHUB_OUTPUT
git log -1 --pretty=%B ${{ github.event.pull_request.head.sha }} >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT

fix:
name: Fix
runs-on: ubuntu-latest
needs: check-sensitive
if: |
always() &&
needs.check-sensitive.outputs.skip_fix != 'true' &&
needs.check-sensitive.outputs.require_approval == 'false'

outputs:
changes_detected: ${{ steps.fix-stuff.outputs.changes_detected }}

permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
token: ${{ secrets.ROBOT_GITHUB_TOKEN }}
ref: ${{ github.head_ref }}

- name: Fix Stuff
id: fix-stuff
uses: ./.github/actions/fix-stuff

fix-sensitive:
name: Fix (Sensitive)
runs-on: ubuntu-latest
environment: Require Approval
needs: check-sensitive
if: |
always() &&
needs.check-sensitive.outputs.skip_fix != 'true' &&
needs.check-sensitive.outputs.require_approval == 'true'

outputs:
changes_detected: false

permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
token: ${{ secrets.ROBOT_GITHUB_TOKEN }}
ref: ${{ github.head_ref }}

- name: Fix Stuff
id: fix-stuff
uses: ./.github/actions/fix-stuff

lint:
name: General Linting
needs: [fix, fix-sensitive]
if: |
always() &&
needs.fix.outputs.changes_detected != 'true' && needs.fix-sensitive.outputs.changes_detected != 'true'
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v7

- uses: ./.github/actions/setup

- name: Lint code
run: npm run lint:ultracite

- name: Lint tasks
run: npm run lint:tasks

- name: Lint schema
run: npm run lint:schema

- name: Lint UUIDs
run: npm run lint:uuids

lint-links:
name: Link Links
needs: [fix, fix-sensitive]
if: |
always() &&
needs.fix.outputs.changes_detected != 'true' && needs.fix-sensitive.outputs.changes_detected != 'true'
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v7

- uses: ./.github/actions/setup

- name: Cache
uses: actions/cache@v6
with:
path: .cache
key: cache-${{ hashFiles('tiers/*.json') }}
restore-keys: |
cache-

- name: Lint links
run: npm run lint:links

check-types:
name: Check Typescript Types
needs: [fix, fix-sensitive]
if: |
always() &&
needs.fix.outputs.changes_detected != 'true' && needs.fix-sensitive.outputs.changes_detected != 'true'
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v7

- uses: ./.github/actions/setup

- name: Generate types
run: npm run gen:types

- name: Ensure types are up to date
run: |
if [ -n "$(git status --porcelain)" ]; then
exit 1
fi
67 changes: 0 additions & 67 deletions .github/workflows/lint-and-check-gen.yml

This file was deleted.