@@ -13,6 +13,15 @@ defaults:
1313 run :
1414 shell : pwsh
1515
16+ env :
17+ # Need to checkout the same commit from the workflow run that triggered this workflow.
18+ # By default the checkout step gets the latest from master but that's not what we want.
19+ # Without checking out the workflow run head sha the errors that we get into are like:
20+ # - Create a PR, that will run the workflows that trigger this one but then, instead of
21+ # checking commit from the PR, we get the commit from master. This would mean we would
22+ # run this workflow which builds the docker image and runs tests using the incorrect commit.
23+ WORKFLOW_HEAD_SHA : ${{ github.event.workflow_run.head_sha }}
24+
1625jobs :
1726 trigger-info :
1827 name : Trigger info
3948 GITHUB_CONTEXT : ${{ toJSON(github) }}
4049 run : $env:GITHUB_CONTEXT
4150 - uses : actions/checkout@v3
51+ with :
52+ ref : ${{ env.WORKFLOW_HEAD_SHA }}
4253 - name : Run markdown link check log parser with only errors set to true
4354 id : mlc-log-parser
4455 uses : ./action-local
@@ -132,6 +143,8 @@ jobs:
132143 GITHUB_CONTEXT : ${{ toJSON(github) }}
133144 run : $env:GITHUB_CONTEXT
134145 - uses : actions/checkout@v3
146+ with :
147+ ref : ${{ env.WORKFLOW_HEAD_SHA }}
135148 - name : Run markdown link check log parser with only errors set to true
136149 id : mlc-log-parser
137150 uses : ./action-local
@@ -200,6 +213,8 @@ jobs:
200213 GITHUB_CONTEXT : ${{ toJSON(github) }}
201214 run : $env:GITHUB_CONTEXT
202215 - uses : actions/checkout@v3
216+ with :
217+ ref : ${{ env.WORKFLOW_HEAD_SHA }}
203218 - name : Run markdown link check log parser with markdown step output
204219 id : mlc-log-parser
205220 uses : ./action-local
@@ -268,6 +283,8 @@ jobs:
268283 GITHUB_CONTEXT : ${{ toJSON(github) }}
269284 run : $env:GITHUB_CONTEXT
270285 - uses : actions/checkout@v3
286+ with :
287+ ref : ${{ env.WORKFLOW_HEAD_SHA }}
271288 - name : Run markdown link check log parser with only errors set to false
272289 id : mlc-log-parser
273290 uses : ./action-local
@@ -361,6 +378,8 @@ jobs:
361378 GITHUB_CONTEXT : ${{ toJSON(github) }}
362379 run : $env:GITHUB_CONTEXT
363380 - uses : actions/checkout@v3
381+ with :
382+ ref : ${{ env.WORKFLOW_HEAD_SHA }}
364383 - name : Run markdown link check log parser with only errors set to false
365384 id : mlc-log-parser
366385 uses : ./action-local
@@ -429,6 +448,8 @@ jobs:
429448 GITHUB_CONTEXT : ${{ toJSON(github) }}
430449 run : $env:GITHUB_CONTEXT
431450 - uses : actions/checkout@v3
451+ with :
452+ ref : ${{ env.WORKFLOW_HEAD_SHA }}
432453 - name : Run markdown link check log parser with markdown step output
433454 id : mlc-log-parser
434455 uses : ./action-local
@@ -497,6 +518,8 @@ jobs:
497518 GITHUB_CONTEXT : ${{ toJSON(github) }}
498519 run : $env:GITHUB_CONTEXT
499520 - uses : actions/checkout@v3
521+ with :
522+ ref : ${{ env.WORKFLOW_HEAD_SHA }}
500523 - name : Run markdown link check log parser with default action args
501524 uses : ./action-local
502525 id : mlc-log-parser
@@ -524,6 +547,8 @@ jobs:
524547 GITHUB_CONTEXT : ${{ toJSON(github) }}
525548 run : $env:GITHUB_CONTEXT
526549 - uses : actions/checkout@v3
550+ with :
551+ ref : ${{ env.WORKFLOW_HEAD_SHA }}
527552 - name : Run markdown link check log parser with bad input
528553 id : mlc-log-parser-bad-input
529554 uses : ./action-local
@@ -566,7 +591,6 @@ jobs:
566591 env :
567592 GITHUB_CONTEXT : ${{ toJSON(github) }}
568593 run : $env:GITHUB_CONTEXT
569- - uses : actions/checkout@v3
570594 - name : Create GitHub status on PR
571595 run : |
572596 $onlyErrorsTrueFilesOutputJobResult = '${{ needs.only-errors-true-files-output.result }}'
0 commit comments