forked from Adeptus-Dominus/ChapterMaster
-
Notifications
You must be signed in to change notification settings - Fork 1
Ci/gobo #259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Ci/gobo #259
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
tj-actions/changed-files@v44 separator option documentation💡 Result:
In
tj-actions/changed-files@v44, theseparatorinput controls the delimiter used when the action returns “list” outputs as a single string (e.g.,all_changed_files). It’s documented as:separator" "(a single space) [1]Example:
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.gmlfile 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
separatorinput 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