@@ -82,11 +82,22 @@ jobs:
8282 env :
8383 RUN_ID : ${{ github.event.workflow_run.id }}
8484
85+ - name : Check for artifact
86+ id : artifact-check
87+ run : |
88+ if [ -f "./pr-data.zip" ]; then
89+ echo "exists=false" >> "$GITHUB_OUTPUT"
90+ else
91+ echo "exists=true" >> "$GITHUB_OUTPUT"
92+ fi
93+
8594 - name : Unzip the artifact containing the PR data
95+ if : ${{ steps.artifact-check.outputs.exists == 'true' }}
8696 run : unzip pr-data.zip
8797
8898 - name : Generate Installation Token
8999 id : generate_token
100+ if : ${{ steps.artifact-check.outputs.exists == 'true' }}
90101 env :
91102 GH_APP_ID : ${{ secrets.GH_APP_ID }}
92103 GH_APP_PRIVATE_KEY : ${{ secrets.GH_APP_PRIVATE_KEY }}
@@ -122,29 +133,36 @@ jobs:
122133
123134 - name : Checkout repository
124135 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
136+ if : ${{ steps.artifact-check.outputs.exists == 'true' }}
125137 with :
126138 repository : ${{ github.event.workflow_run.repository.full_name }}
127139 ref : ${{ github.event.workflow_run.head_branch }}
128140 show-progress : ${{ runner.debug == '1' && 'true' || 'false' }}
129141 token : ${{ env.ACCESS_TOKEN }}
130142
131143 - name : Apply patch
144+ if : ${{ steps.artifact-check.outputs.exists == 'true' }}
132145 run : git apply ../pr-data/patch.diff
133146
134147 - name : Display changes to versioned files
148+ if : ${{ steps.artifact-check.outputs.exists == 'true' }}
135149 run : git diff
136150
137151 - name : Configure git user name and email
152+ if : ${{ steps.artifact-check.outputs.exists == 'true' }}
138153 run : |
139154 git config user.name "test-wp-build-script-commit[bot]"
140155 git config user.email ${{ env.GH_APP_ID }}+test-wp-build-script-commit[bot]@users.noreply.github.com
141156
142157 - name : Stage changes
158+ if : ${{ steps.artifact-check.outputs.exists == 'true' }}
143159 run : git add .
144160
145161 - name : Commit changes
162+ if : ${{ steps.artifact-check.outputs.exists == 'true' }}
146163 run : |
147164 git commit -m "Automation: Updating built files with changes. [dependabot skip]"
148165
149166 - name : Push changes
167+ if : ${{ steps.artifact-check.outputs.exists == 'true' }}
150168 run : git push
0 commit comments