Skip to content
Closed
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
119 changes: 66 additions & 53 deletions .github/workflows/fix-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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: |
Expand All @@ -36,25 +36,44 @@ jobs:
- name: Get Latest Commit Message
id: skip-fix
run: |
git log
echo 'commit_message<<EOF' >> $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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/node_modules
/lists

/.cache
1 change: 1 addition & 0 deletions bin/frac.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion tiers/easy.json
Original file line number Diff line number Diff line change
Expand Up @@ -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! ",
Expand Down