diff --git a/.github/workflows/comment-command.yml b/.github/workflows/comment-command.yml index 6b7847b31b2..fd9907a3622 100644 --- a/.github/workflows/comment-command.yml +++ b/.github/workflows/comment-command.yml @@ -37,21 +37,22 @@ jobs: workflow: lint-format.yml pr: ${{ github.event.issue.number }} workflow_conclusion: "failure" # Format failure -> patches available + if_no_artifact_found: warn allow_forks: false - run: echo "${{ toJSON(fromJSON(steps.fetch-patches.outputs.artifacts).*.name) }}" - name: Check found artifacts id: check-found-artifacts run: | - echo "${{ contains(fromJSON(steps.fetch-patches.outputs.artifacts).*.name, 'javaformat fixes')}}" - echo "${{ contains(fromJSON(steps.fetch-patches.outputs.artifacts).*.name, 'wpiformat fixes')}}" - echo "artifacts-found=${{ contains(fromJSON(steps.fetch-patches.outputs.artifacts).*.name, 'javaformat fixes') + echo "found-artifacts=${{ contains(fromJSON(steps.fetch-patches.outputs.artifacts).*.name, 'javaformat fixes') && contains(fromJSON(steps.fetch-patches.outputs.artifacts).*.name, 'wpiformat fixes') }}" >> "$GITHUB_OUTPUT" - name: Apply patch + if: ${{ steps.check-found-artifacts.outputs.found-artifacts }} run: | git apply "wpiformat fixes/wpiformat-fixes.patch" --index # Apply java format and prefer new changes git apply "javaformat fixes/javaformat-fixes.patch" --3way --theirs --index - name: Commit + if: ${{ steps.check-found-artifacts.outputs.found-artifacts }} run: | # Set credentials git config user.name "github-actions[bot]" @@ -86,12 +87,12 @@ jobs: NUMBER: ${{ github.event.issue.number }} - name: Fetch patches id: fetch-patches - # Fails workflow if artifact not found uses: dawidd6/action-download-artifact@v7 with: workflow: lint-format.yml pr: ${{ github.event.issue.number }} name: pregenerated-files-fixes + workflow_conclusion: "failure" # Pregen failure -> patches available if_no_artifact_found: warn allow_forks: false - name: Apply patch