From 5e5f023b8a8875263fb3786b6030944b7a9f9bde Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Tue, 17 Sep 2024 16:35:31 -0700 Subject: [PATCH] Only try to commit formated files if running on the owncast/owncast repo --- .../workflows/javascript-format-test-build.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/javascript-format-test-build.yml b/.github/workflows/javascript-format-test-build.yml index d8c801b71..ba766936a 100644 --- a/.github/workflows/javascript-format-test-build.yml +++ b/.github/workflows/javascript-format-test-build.yml @@ -71,19 +71,27 @@ jobs: - name: Install Dependencies run: npm install - - name: Lint - if: steps.changed-files-yaml.outputs.src_any_changed == 'true' + - name: Lint and fix + if: steps.changed-files-yaml.outputs.src_any_changed == 'true' && github.repository == 'owncast/owncast' run: npx eslint --fix ${{ steps.changed-files-yaml.outputs.src_all_changed_files }} - - name: Prettier - if: steps.changed-files-yaml.outputs.src_any_changed == 'true' + - name: Lint + if: steps.changed-files-yaml.outputs.src_any_changed == 'true' && github.repository != 'owncast/owncast' + run: npx eslint --fix ${{ steps.changed-files-yaml.outputs.src_all_changed_files }} + + - name: Prettier formatting + if: steps.changed-files-yaml.outputs.src_any_changed == 'true' && github.repository == 'owncast/owncast' run: npx prettier --write ${{ steps.changed-files-yaml.outputs.src_all_changed_files }} + - name: Prettier check + if: steps.changed-files-yaml.outputs.src_any_changed == 'true' && github.repository != 'owncast/owncast' + run: npx prettier ${{ steps.changed-files-yaml.outputs.src_all_changed_files }} + - name: Debug changed files output run: 'pwd && echo "Changed files: ${{ steps.changed-files-yaml.outputs.src_all_changed_files }}"' - name: Commit changes - if: steps.changed-files-yaml.outputs.src_any_changed == 'true' + if: steps.changed-files-yaml.outputs.src_any_changed == 'true' && github.repository == 'owncast/owncast' uses: EndBug/add-and-commit@v9 with: author_name: Owncast