diff --git a/.github/workflows/fix-and-lint.yml b/.github/workflows/fix-and-lint.yml index 10bc381..3d36887 100644 --- a/.github/workflows/fix-and-lint.yml +++ b/.github/workflows/fix-and-lint.yml @@ -5,12 +5,12 @@ on: branches: ["main"] jobs: - check-sensitive: - name: Check for Sensitive Files - runs-on: ubuntu-latest + check-prereqs: + name: Check for Prerequisites + runs-on: ubuntu-slim outputs: - require_approval: ${{ steps.changed-sensitive.outputs.any_changed || false }} + require_approval: ${{ steps.check-sensitive.outputs.any_changed || false }} skip_fix: ${{ contains(steps.skip-fix.outputs.commit_message, 'skip-fix') }} steps: @@ -23,8 +23,8 @@ jobs: allow-unsafe-pr-checkout: true - 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 + id: check-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: | @@ -36,25 +36,44 @@ jobs: - name: Get Latest Commit Message id: skip-fix run: | - git log echo 'commit_message<> $GITHUB_OUTPUT git log -1 --pretty=%B ${{ github.event.pull_request.head.sha }} >> $GITHUB_OUTPUT echo 'EOF' >> $GITHUB_OUTPUT + request-approval: + name: Request Approval + runs-on: ubuntu-slim + environment: Require Approval + needs: check-prereqs + if: needs.check-prereqs.outputs.require_approval != 'false' + + steps: + - run: true + + safety-gate: + name: Safety Gate + runs-on: ubuntu-slim + needs: [check-prereqs, request-approval] + if: | + always() && + needs.check-prereqs.result == 'success' && + (needs.request-approval.result == 'success' || needs.check-prereqs.outputs.require_approval == 'false') + + steps: + - run: true + fix: name: Fix - runs-on: ubuntu-latest - needs: check-sensitive + runs-on: ubuntu-slim + needs: [safety-gate, check-prereqs] if: | always() && - needs.check-sensitive.outputs.skip_fix != 'true' && - needs.check-sensitive.outputs.require_approval == 'false' + needs.safety-gate.result == 'success' && + needs.check-prereqs.result == 'success' && + needs.check-prereqs.outputs.skip_fix != 'true' outputs: - changes_detected: ${{ steps.fix-stuff.outputs.changes_detected }} - - permissions: - contents: write + skip_lint: ${{ steps.commit-changes.outputs.changes_detected }} steps: - name: Checkout repository @@ -64,50 +83,44 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} allow-unsafe-pr-checkout: true + - uses: ./.github/actions/setup - - name: Fix Stuff - id: fix-stuff - uses: ./.github/actions/fix-stuff + - name: Format Code + shell: bash + run: npm run format + + - name: Generate UUIDs + shell: bash + run: npm run gen:uuids + + - name: Commit Changes + id: commit-changes + uses: stefanzweifel/git-auto-commit-action@v7 with: commit_author: "${{ github.event.pull_request.user.login }} <${{ github.event.pull_request.user.login }}+${{ github.event.pull_request.user.id }}@users.noreply.github.com>" - - fix-sensitive: - name: Fix (Sensitive) - runs-on: ubuntu-latest - environment: Require Approval - needs: check-sensitive + commit_user_name: osrs-taskbot + commit_user_email: r.mobis+taskbot@gmail.com + commit_message: "[skip-fix] format and generate missing UUIDs" + + lint-gate: + name: Lint Gate + runs-on: ubuntu-slim + needs: [safety-gate, fix] if: | always() && - needs.check-sensitive.outputs.require_approval != 'false' - - outputs: - changes_detected: false - - permissions: - contents: write + needs.safety-gate.result == 'success' && + needs.fix.outputs.skip_lint != 'true' steps: - - name: Checkout repository - uses: actions/checkout@v7 - with: - token: ${{ secrets.ROBOT_GITHUB_TOKEN }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.head_ref }} - allow-unsafe-pr-checkout: true - - - name: Fix Stuff - id: fix-stuff - uses: ./.github/actions/fix-stuff - with: - commit_author: "${{ github.event.pull_request.user.login }} <${{ github.event.pull_request.user.login }}+${{ github.event.pull_request.user.id }}@users.noreply.github.com>" + - run: true lint: name: General Linting - needs: [fix, fix-sensitive] + needs: lint-gate if: | always() && - needs.fix.outputs.changes_detected != 'true' && needs.fix-sensitive.outputs.changes_detected != 'true' - runs-on: ubuntu-latest + needs.lint-gate.result == 'success' + runs-on: ubuntu-slim steps: - name: Checkout repository @@ -129,11 +142,11 @@ jobs: lint-links: name: Link Links - needs: [fix, fix-sensitive] + needs: lint-gate if: | always() && - needs.fix.outputs.changes_detected != 'true' && needs.fix-sensitive.outputs.changes_detected != 'true' - runs-on: ubuntu-latest + needs.lint-gate.result == 'success' + runs-on: ubuntu-slim steps: - name: Checkout repository @@ -154,11 +167,11 @@ jobs: check-types: name: Check Typescript Types - needs: [fix, fix-sensitive] + needs: lint-gate if: | always() && - needs.fix.outputs.changes_detected != 'true' && needs.fix-sensitive.outputs.changes_detected != 'true' - runs-on: ubuntu-latest + needs.lint-gate.result == 'success' + runs-on: ubuntu-slim steps: - name: Checkout repository diff --git a/.gitignore b/.gitignore index 0c3ad3b..3606d82 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /node_modules /lists + /.cache \ No newline at end of file diff --git a/bin/frac.mts b/bin/frac.mts index 4c66e7e..db9c475 100644 --- a/bin/frac.mts +++ b/bin/frac.mts @@ -28,6 +28,7 @@ let fileCount = 0, const walker = new Glob(fileGlobs, {}); for await (const file of walker) { fileCount++; + const content = (await readFile(file)).toString(); const formattedContent = fmt.Reformat(content); diff --git a/tiers/easy.json b/tiers/easy.json index 8d195bb..2e4f065 100644 --- a/tiers/easy.json +++ b/tiers/easy.json @@ -2431,7 +2431,7 @@ } }, { - "id": "ffc96e1a-1d48-42c4-97f5-a6946bc61379", + "id": "d357e7cc-ceff-431f-850e-58995ecdbbab", "name": "Get a Warped sceptre", "shortName": "Warped Sceptre", "tip": "Obtained as a drop from Warped terrorbirds and tortoises. The tortoises can be safespotted in the first room. Requires completion of The Path of Glouphrie quest. Don't forget your crystal chimes! ",