Skip to content

Commit

Permalink
Only apply patch if it is non-empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Ortham committed Jul 6, 2024
1 parent a5162cb commit f7b81c8
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion .github/workflows/push-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,43 @@ on:
types: [completed]

jobs:
import:
check-for-changes:
runs-on: ubuntu-20.04

if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
outputs:
is-patch-empty: ${{ steps.check-patch.outputs.is-empty }}

steps:
- name: Download the pull request run's artifact
uses: actions/download-artifact@v4
with:
name: sync-translations-data
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}

- name: Check if the patch contains any changes
id: check-patch
run: |
if [ -s sync-translations.patch ]
then
echo "Patch is not empty"
echo "is-empty=0" >> "$GITHUB_OUTPUT"
else
echo "Patch is empty"
echo "is-empty=1" >> "$GITHUB_OUTPUT"
fi
apply-patch:
runs-on: ubuntu-20.04

needs: [check-for-changes]

if: needs.check-for-changes.outputs.is-patch-empty == 0

permissions:
contents: write

Expand Down

0 comments on commit f7b81c8

Please sign in to comment.