Skip to content

Commit

Permalink
only apply if artifacts found
Browse files Browse the repository at this point in the history
  • Loading branch information
rzblue committed Dec 23, 2024
1 parent 8aba539 commit e138b25
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/comment-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e138b25

Please sign in to comment.