-
Notifications
You must be signed in to change notification settings - Fork 1
Test #260
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
Test #260
Changes from all commits
3d3e9c7
ceecfa1
b436d59
a4de709
031b1d9
7f6eedb
4750b09
9584347
3062c2f
a32c8bf
9a12cb3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,40 +1,52 @@ | ||||||||||||||||||||||||||||
| name: GoboLint | ||||||||||||||||||||||||||||
| name: Gobo Lint | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||
| issue_comment: | ||||||||||||||||||||||||||||
| types: [created] | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||
| lint: | ||||||||||||||||||||||||||||
| format: | ||||||||||||||||||||||||||||
| 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') | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| startsWith(github.event.comment.body, '/format') && | ||||||||||||||||||||||||||||
| (github.event.comment.author_association == 'MEMBER' || | ||||||||||||||||||||||||||||
| github.event.comment.author_association == 'OWNER' || | ||||||||||||||||||||||||||||
| github.event.comment.author_association == 'COLLABORATOR') | ||||||||||||||||||||||||||||
| 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: Fetch PR Details | ||||||||||||||||||||||||||||
| id: pr | ||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||
| # Use the GitHub CLI to get the branch name and the full repository name (owner/repo) | ||||||||||||||||||||||||||||
| PR_JSON=$(gh pr view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json headRefName,headRepositoryOwner,headRepository) | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| # Extract values using jq | ||||||||||||||||||||||||||||
| HEAD_REF=$(echo "$PR_JSON" | jq -r .headRefName) | ||||||||||||||||||||||||||||
| HEAD_OWNER=$(echo "$PR_JSON" | jq -r .headRepositoryOwner.login) | ||||||||||||||||||||||||||||
| HEAD_REPO_NAME=$(echo "$PR_JSON" | jq -r .headRepository.name) | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| echo "head_ref=$HEAD_REF" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||
| echo "head_repo=$HEAD_OWNER/$HEAD_REPO_NAME" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Checkout PR 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 }} | ||||||||||||||||||||||||||||
| token: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||
| repository: ${{ steps.pr.outputs.head_repo }} | ||||||||||||||||||||||||||||
| ref: ${{ steps.pr.outputs.head_ref }} | ||||||||||||||||||||||||||||
| 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 }} | ||||||||||||||||||||||||||||
| base_sha: ${{ github.event.issue.pull_request.base.sha }} | ||||||||||||||||||||||||||||
| files: '**.gml' | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Setup Gobo | ||||||||||||||||||||||||||||
|
|
@@ -44,19 +56,19 @@ jobs: | |||||||||||||||||||||||||||
| unzip gobo-ubuntu.zip | ||||||||||||||||||||||||||||
| chmod +x ./gobo | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Run Linter | ||||||||||||||||||||||||||||
| - name: Run Formatter | ||||||||||||||||||||||||||||
| 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..." | ||||||||||||||||||||||||||||
| echo "Formatting $file..." | ||||||||||||||||||||||||||||
| ./gobo "$file" | ||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||
|
Comment on lines
62
to
67
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same filename-with-spaces issue here too, nyan~! Just like in 🐱 Suggested fix, nyan~ - name: Run Linter
if: steps.changed-files.outputs.any_changed == 'true'
run: |
+ IFS=$'\n'
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [ -f "$file" ]; then
echo "Linting $file..."
./gobo "$file"
fi
doneOr configure the changed-files action with 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Commit Changes | ||||||||||||||||||||||||||||
| - name: Commit and Push 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" | ||||||||||||||||||||||||||||
| commit_message: "style: Auto-format GML files with Gobo" | ||||||||||||||||||||||||||||
| file_pattern: '**.gml' | ||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.