Skip to content

Commit b474a1f

Browse files
committed
ci: fixed issue when workflow does not runs if commit was from pull request
1 parent edd7569 commit b474a1f

File tree

2 files changed

+7
-28
lines changed

2 files changed

+7
-28
lines changed

.github/workflows/documentation-deploy.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,14 @@ jobs:
4747
npm ci
4848
npm run build
4949
50-
- name: Check for pull request
51-
uses: 8BitJonny/[email protected]
52-
id: pr-check
53-
with:
54-
# Verbose setting SHA when using Pull_Request event trigger to fix #16. (For push even trigger this is not necessary.)
55-
sha: ${{ github.event.pull_request.head.sha }}
56-
5750
- name: Upload artifact
58-
if: ${{ always() && github.ref == 'refs/heads/master' && steps.pr-check.outputs.pr_found == 'false' }}
51+
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' && !github.event.pull_request }}
5952
uses: actions/upload-pages-artifact@v3
6053
with:
6154
path: './documentation/build'
6255

6356
- name: Deploy to GitHub Pages
64-
if: ${{ always() && github.ref == 'refs/heads/master' && steps.pr-check.outputs.pr_found == 'false' }}
57+
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' && !github.event.pull_request }}
6558
id: deployment
6659
uses: actions/deploy-pages@v4
6760

.github/workflows/nightly-builds.yml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ jobs:
4242
- name: Obtain running job information
4343
uses: qoomon/actions--context@v4
4444

45-
- name: Check for pull request
46-
uses: 8BitJonny/[email protected]
47-
id: pr-check
48-
with:
49-
# Verbose setting SHA when using Pull_Request event trigger to fix #16. (For push even trigger this is not necessary.)
50-
sha: ${{ github.event.pull_request.head.sha }}
51-
5245
- name: Checkout repository
5346
uses: actions/checkout@v4
5447
with:
@@ -145,7 +138,7 @@ jobs:
145138

146139
- name: Saving vcpkg assets to cache
147140
uses: actions/cache/save@v4
148-
if: ${{ always() && github.ref == 'refs/heads/master' && steps.pr-check.outputs.pr_found == 'false' }}
141+
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' && !github.event.pull_request }}
149142
with:
150143
path: |
151144
${{ env.VCPKG_ROOT }}
@@ -206,21 +199,14 @@ jobs:
206199
runs-on: ubuntu-latest
207200
needs: [build-generic]
208201
steps:
209-
- name: Check for pull request
210-
uses: 8BitJonny/[email protected]
211-
id: pr-check
212-
with:
213-
# Verbose setting SHA when using Pull_Request event trigger to fix #16. (For push even trigger this is not necessary.)
214-
sha: ${{ github.event.pull_request.head.sha }}
215-
216202
- name: Fetch artifacts
217-
if: ${{ always() && github.ref == 'refs/heads/master' && steps.pr-check.outputs.pr_found == 'false' }}
203+
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' && !github.event.pull_request }}
218204
uses: actions/download-artifact@v4
219205
with:
220206
path: artifacts/
221207

222208
- name: Remove old release
223-
if: ${{ always() && github.ref == 'refs/heads/master' && steps.pr-check.outputs.pr_found == 'false' }}
209+
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' && !github.event.pull_request }}
224210
uses: dev-drprasad/[email protected]
225211
with:
226212
delete_release: true
@@ -229,7 +215,7 @@ jobs:
229215
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
230216

231217
- name: Repackage binaries and allow GitHub to process removed release for few seconds
232-
if: ${{ always() && github.ref == 'refs/heads/master' && steps.pr-check.outputs.pr_found == 'false' }}
218+
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' && !github.event.pull_request }}
233219
continue-on-error: true
234220
run: |
235221
cd artifacts/
@@ -242,7 +228,7 @@ jobs:
242228
sleep 20s
243229
244230
- name: Upload new release
245-
if: ${{ always() && github.ref == 'refs/heads/master' && steps.pr-check.outputs.pr_found == 'false' }}
231+
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' && !github.event.pull_request }}
246232
uses: softprops/[email protected]
247233
with:
248234
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)