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
8 changes: 5 additions & 3 deletions .github/workflows/gobo_check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Format Code
name: GoboLintCheck

on:
pull_request:
Expand Down Expand Up @@ -31,8 +31,10 @@ jobs:
- name: Run Formatter
if: steps.changed-files.outputs.any_changed == 'true'
run: |
# Pass all changed files to gobo at once
./gobo ${{ steps.changed-files.outputs.all_changed_files }}
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "Formatting $file..."
./gobo "$file"
done
Comment on lines +34 to +37
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

tj-actions/changed-files@v44 separator option documentation

💡 Result:

In tj-actions/changed-files@v44, the separator input controls the delimiter used when the action returns “list” outputs as a single string (e.g., all_changed_files). It’s documented as:

  • Input: separator
  • Description: “Split character for output strings.”
  • Default: " " (a single space)  [1]

Example:

- id: changed-files
  uses: tj-actions/changed-files@v44
  with:
    separator: ","

You can see the same input documented on the action’s GitHub Marketplace page under “Inputs”. [2]

Sources: [1] (gitea.angry.im) [2] (github.com)

Citations:


Shell word-splitting could break on filenames with spaces, nyan!

The unquoted ${{ steps.changed-files.outputs.all_changed_files }} will cause issues if any .gml file has spaces or special characters in its name, since the action outputs space-separated filenames by default and shell word-splitting will break the loop iteration, nyan~

Use the separator input to switch to newline-separated output, then process with a safe loop pattern, nyan!

🐱 Proposed fix using newline separator, nyan~
       - name: Get Changed Files
         id: changed-files
         uses: tj-actions/changed-files@v44
         with:
           files: '**.gml'
+          separator: "\n"

       - name: Setup Gobo
         if: steps.changed-files.outputs.any_changed == 'true'
         run: |
           curl -LO https://github.com/EttyKitty/Gobo/releases/download/v1.0.0/gobo-ubuntu.zip
           unzip gobo-ubuntu.zip
           chmod +x ./gobo

       - name: Run Formatter
         if: steps.changed-files.outputs.any_changed == 'true'
         run: |
-          for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
-            echo "Formatting $file..."
-            ./gobo "$file"
-          done
+          while IFS= read -r file; do
+            if [[ -n "$file" ]]; then
+              echo "Formatting $file..."
+              ./gobo "$file"
+            fi
+          done <<< "${{ steps.changed-files.outputs.all_changed_files }}"
🤖 Prompt for AI Agents
In @.github/workflows/gobo_check.yml around lines 34 - 37, The loop over `${{
steps.changed-files.outputs.all_changed_files }}` is vulnerable to shell
word-splitting for filenames with spaces; set the changed-files action to emit
newline-separated output (use the `separator: '\n'` input) and iterate safely,
e.g. read each filename with `while IFS= read -r file; do ./gobo "$file"; done
<<< "${{ steps.changed-files.outputs.all_changed_files }}" so you correctly
handle spaces and special characters; ensure you still call `./gobo "$file"`
(quoted) when processing each entry.


- name: Verify Formatting
run: |
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/gobo_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: GoboLint

on:
issue_comment:
types: [created]

jobs:
lint:
if: >
github.event.issue.pull_request &&
startsWith(github.event.comment.body, '/lint') &&
(github.event.comment.author_association == 'COLLABORATOR' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'OWNER')

runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Get PR branch
uses: xt0rted/pull-request-comment-branch@v2
id: comment-branch

- name: Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ steps.comment-branch.outputs.head_ref }}
repository: ${{ steps.comment-branch.outputs.head_owner }}/${{ steps.comment-branch.outputs.head_repo }}
fetch-depth: 0

- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@v44
with:
base_sha: ${{ steps.comment-branch.outputs.base_ref }}
files: '**.gml'

- name: Setup Gobo
if: steps.changed-files.outputs.any_changed == 'true'
run: |
curl -LO https://github.com/EttyKitty/Gobo/releases/download/v1.0.0/gobo-ubuntu.zip
unzip gobo-ubuntu.zip
chmod +x ./gobo

- name: Run Linter
if: steps.changed-files.outputs.any_changed == 'true'
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [ -f "$file" ]; then
echo "Linting $file..."
./gobo "$file"
fi
done

- name: Commit Changes
if: steps.changed-files.outputs.any_changed == 'true'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: auto-lint GML files with Gobo"
file_pattern: '**.gml'
Loading