diff --git a/.github/workflows/gobo_lint.yml b/.github/workflows/gobo_lint.yml index 355c798d9..a4b884a8a 100644 --- a/.github/workflows/gobo_lint.yml +++ b/.github/workflows/gobo_lint.yml @@ -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 - - 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' \ No newline at end of file diff --git a/scripts/scr_animated_scanline/scr_animated_scanline.gml b/scripts/scr_animated_scanline/scr_animated_scanline.gml index 91b39a4af..11394b9ea 100644 --- a/scripts/scr_animated_scanline/scr_animated_scanline.gml +++ b/scripts/scr_animated_scanline/scr_animated_scanline.gml @@ -6,9 +6,8 @@ function draw_animated_scanline(x1, y1, width, height, time = 10, color = 599838 if (anim <= 10) { draw_set_alpha(anim / 10); } else { - draw_set_alpha(2 - (anim / 10)); - } - line_move = y1 + (height * ((anim % 20) / 20)); + draw_set_alpha(2-(anim / 10)); + }line_move = y1 + (height * ((anim % 20) / 20)); if (irandom(100) <= 5) { line_move -= 4; }