From f8299c05b49f6680cfc2f2a50b1a388559b472d5 Mon Sep 17 00:00:00 2001 From: amy Date: Sun, 7 Jun 2026 11:47:08 +0100 Subject: [PATCH 1/8] this might work, idk --- .github/workflows/autolint.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/autolint.yml diff --git a/.github/workflows/autolint.yml b/.github/workflows/autolint.yml new file mode 100644 index 0000000000..3e29a960ba --- /dev/null +++ b/.github/workflows/autolint.yml @@ -0,0 +1,29 @@ +name: AutoLint +on: issue_comment + +jobs: + pr_commented: + # This job only runs for pull request comments + name: PR comment + if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '!autolint') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup submodule + run: | + git submodule update --init --recursive + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 10.0.x + - name: Setup Resharper + run: dotnet tool install -g JetBrains.ReSharper.GlobalTools + - name: Run Linter + run: jb cleanupcode OpenDream.slnx + - name: Push changes + run: | + git config user.name "github-actions" + git config user.email "github-actions@github.com" + git add . + git commit -m "Auto-lint changes" + git push \ No newline at end of file From 92d6df783a7e62fce87e60152e6fd9e3fc2bd26b Mon Sep 17 00:00:00 2001 From: amy Date: Sun, 7 Jun 2026 12:22:20 +0100 Subject: [PATCH 2/8] filter by file --- .github/workflows/autolint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/autolint.yml b/.github/workflows/autolint.yml index 3e29a960ba..e43593d7df 100644 --- a/.github/workflows/autolint.yml +++ b/.github/workflows/autolint.yml @@ -19,7 +19,7 @@ jobs: - name: Setup Resharper run: dotnet tool install -g JetBrains.ReSharper.GlobalTools - name: Run Linter - run: jb cleanupcode OpenDream.slnx + run: jb cleanupcode ${git diff --diff-filter=ACMR --name-only origin/master...HEAD} - name: Push changes run: | git config user.name "github-actions" From f34d7ed515856eb8c49da1d6522141c13a840879 Mon Sep 17 00:00:00 2001 From: amy Date: Sun, 7 Jun 2026 12:27:48 +0100 Subject: [PATCH 3/8] xargs? --- .github/workflows/autolint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/autolint.yml b/.github/workflows/autolint.yml index e43593d7df..51bca70ae1 100644 --- a/.github/workflows/autolint.yml +++ b/.github/workflows/autolint.yml @@ -19,7 +19,7 @@ jobs: - name: Setup Resharper run: dotnet tool install -g JetBrains.ReSharper.GlobalTools - name: Run Linter - run: jb cleanupcode ${git diff --diff-filter=ACMR --name-only origin/master...HEAD} + run: git diff --diff-filter=ACMR --name-only origin/master...HEAD | xargs jb cleanupcode - name: Push changes run: | git config user.name "github-actions" From b50f64f0ec7f78bfa96771f572275d7dcf5f0d56 Mon Sep 17 00:00:00 2001 From: amy Date: Sun, 7 Jun 2026 12:59:36 +0100 Subject: [PATCH 4/8] LLM is better at github worflows than me --- .github/workflows/autolint.yml | 54 +++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/.github/workflows/autolint.yml b/.github/workflows/autolint.yml index 51bca70ae1..166e493136 100644 --- a/.github/workflows/autolint.yml +++ b/.github/workflows/autolint.yml @@ -3,27 +3,59 @@ on: issue_comment jobs: pr_commented: - # This job only runs for pull request comments name: PR comment - if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '!autolint') }} + # Runs ONLY if: it's a PR + contains the command + commenter is PR author OR a maintainer + if: > + github.event.issue.pull_request && + contains(github.event.comment.body, '!autolint') && + ( + github.event.comment.user.login == github.event.issue.user.login || + contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) + ) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Setup submodule + # 1. Fetch PR details using the pre-installed GitHub CLI + - name: Get PR branch + id: pr_data + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - git submodule update --init --recursive + HEAD_REF=$(gh pr view ${{ github.event.issue.number }} --json headRefName -q ".headRefName") + HEAD_REPO_OWNER=$(gh pr view ${{ github.event.issue.number }} --json headRepositoryOwner -q ".headRepositoryOwner.login") + + echo "head_ref=$HEAD_REF" >> $GITHUB_OUTPUT + echo "head_repo=$HEAD_REPO_OWNER/${{ github.event.repository.name }}" >> $GITHUB_OUTPUT + + # 2. Checkout the PR branch + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ steps.pr_data.outputs.head_repo }} + ref: ${{ steps.pr_data.outputs.head_ref }} + fetch-depth: 0 + + - name: Setup submodule + run: git submodule update --init --recursive + - name: Setup .NET Core - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: dotnet-version: 10.0.x + - name: Setup Resharper run: dotnet tool install -g JetBrains.ReSharper.GlobalTools + + - name: Fetch origin master + run: git fetch origin master:origin/master + + # 3. Run Linter (Added --no-run-if-empty for safety) - name: Run Linter - run: git diff --diff-filter=ACMR --name-only origin/master...HEAD | xargs jb cleanupcode + run: git diff --diff-filter=ACMR --name-only origin/master...HEAD | xargs --no-run-if-empty jb cleanupcode + + # 4. Push changes back to the PR - name: Push changes run: | - git config user.name "github-actions" - git config user.email "github-actions@github.com" + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" git add . - git commit -m "Auto-lint changes" - git push \ No newline at end of file + git diff-index --quiet HEAD || (git commit -m "Auto-lint changes" && git push origin HEAD:${{ steps.pr_data.outputs.head_ref }}) \ No newline at end of file From 18166ffb01b2775fc30ae42abff636a539b59212 Mon Sep 17 00:00:00 2001 From: amy Date: Sun, 7 Jun 2026 13:12:43 +0100 Subject: [PATCH 5/8] still makes dumb mistakes tho --- .github/workflows/autolint.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/autolint.yml b/.github/workflows/autolint.yml index 166e493136..53b6464162 100644 --- a/.github/workflows/autolint.yml +++ b/.github/workflows/autolint.yml @@ -4,14 +4,14 @@ on: issue_comment jobs: pr_commented: name: PR comment - # Runs ONLY if: it's a PR + contains the command + commenter is PR author OR a maintainer - if: > - github.event.issue.pull_request && - contains(github.event.comment.body, '!autolint') && - ( - github.event.comment.user.login == github.event.issue.user.login || - contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) - ) + # # Runs ONLY if: it's a PR + contains the command + commenter is PR author OR a maintainer + # if: > + # github.event.issue.pull_request && + # contains(github.event.comment.body, '!autolint') && + # ( + # github.event.comment.user.login == github.event.issue.user.login || + # contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) + # ) runs-on: ubuntu-latest steps: # 1. Fetch PR details using the pre-installed GitHub CLI @@ -20,9 +20,9 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - HEAD_REF=$(gh pr view ${{ github.event.issue.number }} --json headRefName -q ".headRefName") - HEAD_REPO_OWNER=$(gh pr view ${{ github.event.issue.number }} --json headRepositoryOwner -q ".headRepositoryOwner.login") - + HEAD_REF=$(gh pr view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json headRefName -q ".headRefName") + HEAD_REPO_OWNER=$(gh pr view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json headRepositoryOwner -q ".headRepositoryOwner.login") + echo "head_ref=$HEAD_REF" >> $GITHUB_OUTPUT echo "head_repo=$HEAD_REPO_OWNER/${{ github.event.repository.name }}" >> $GITHUB_OUTPUT From c257abf7db242261c5ad6f025c026e6c3fb49ff0 Mon Sep 17 00:00:00 2001 From: amy Date: Sun, 7 Jun 2026 13:13:53 +0100 Subject: [PATCH 6/8] uncomment --- .github/workflows/autolint.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/autolint.yml b/.github/workflows/autolint.yml index 53b6464162..8b298695cc 100644 --- a/.github/workflows/autolint.yml +++ b/.github/workflows/autolint.yml @@ -4,14 +4,14 @@ on: issue_comment jobs: pr_commented: name: PR comment - # # Runs ONLY if: it's a PR + contains the command + commenter is PR author OR a maintainer - # if: > - # github.event.issue.pull_request && - # contains(github.event.comment.body, '!autolint') && - # ( - # github.event.comment.user.login == github.event.issue.user.login || - # contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) - # ) + # Runs ONLY if: it's a PR + contains the command + commenter is PR author OR a maintainer + if: > + github.event.issue.pull_request && + contains(github.event.comment.body, '!autolint') && + ( + github.event.comment.user.login == github.event.issue.user.login || + contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) + ) runs-on: ubuntu-latest steps: # 1. Fetch PR details using the pre-installed GitHub CLI From b24d039c27ddf41eab7a721e442f054acda16ed3 Mon Sep 17 00:00:00 2001 From: amy Date: Sun, 7 Jun 2026 13:32:51 +0100 Subject: [PATCH 7/8] include project settings --- .github/workflows/autolint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/autolint.yml b/.github/workflows/autolint.yml index 8b298695cc..d5d26ab325 100644 --- a/.github/workflows/autolint.yml +++ b/.github/workflows/autolint.yml @@ -50,7 +50,7 @@ jobs: # 3. Run Linter (Added --no-run-if-empty for safety) - name: Run Linter - run: git diff --diff-filter=ACMR --name-only origin/master...HEAD | xargs --no-run-if-empty jb cleanupcode + run: git diff --diff-filter=ACMR --name-only origin/master...HEAD | xargs --no-run-if-empty jb cleanupcode OpenDream.slnx --include-files # 4. Push changes back to the PR - name: Push changes From 8d9e46fa3113d55cf7cdd4640eacc74ae667848f Mon Sep 17 00:00:00 2001 From: amy Date: Sun, 7 Jun 2026 13:44:09 +0100 Subject: [PATCH 8/8] Revert "include project settings" This reverts commit b24d039c27ddf41eab7a721e442f054acda16ed3. --- .github/workflows/autolint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/autolint.yml b/.github/workflows/autolint.yml index d5d26ab325..8b298695cc 100644 --- a/.github/workflows/autolint.yml +++ b/.github/workflows/autolint.yml @@ -50,7 +50,7 @@ jobs: # 3. Run Linter (Added --no-run-if-empty for safety) - name: Run Linter - run: git diff --diff-filter=ACMR --name-only origin/master...HEAD | xargs --no-run-if-empty jb cleanupcode OpenDream.slnx --include-files + run: git diff --diff-filter=ACMR --name-only origin/master...HEAD | xargs --no-run-if-empty jb cleanupcode # 4. Push changes back to the PR - name: Push changes