Skip to content

Commit 0bbd567

Browse files
committed
fix(actions/checkout): unexpected double checkouts
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
1 parent 732153a commit 0bbd567

2 files changed

Lines changed: 8 additions & 26 deletions

File tree

.github/workflows/__test-action-checkout-issue-comment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
with:
2424
script: |
2525
const assert = require('node:assert/strict');
26-
const prNumber = 1;
26+
const prNumber = 570;
2727
assert.ok(prNumber, 'Could not determine PR number from static test configuration');
2828
2929
const pr = await github.rest.pulls.get({

actions/checkout/action.yml

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -40,40 +40,22 @@ inputs:
4040
runs:
4141
using: "composite"
4242
steps:
43-
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
44-
if: inputs.ref == '' && github.event_name == 'issue_comment' && inputs.persist-credentials == 'true'
43+
- if: inputs.persist-credentials == 'false'
44+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
4545
with:
46-
ref: refs/pull/${{ github.event.issue.number }}/head
47-
fetch-depth: ${{ inputs.fetch-depth }}
48-
lfs: ${{ inputs.lfs }}
49-
token: ${{ inputs.token || github.token }}
50-
persist-credentials: true
51-
52-
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
53-
if: inputs.ref == '' && github.event_name == 'issue_comment' && inputs.persist-credentials != 'true'
54-
with:
55-
ref: refs/pull/${{ github.event.issue.number }}/head
46+
ref: ${{ inputs.ref == '' && github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || inputs.ref }}
5647
fetch-depth: ${{ inputs.fetch-depth }}
5748
lfs: ${{ inputs.lfs }}
49+
sparse-checkout: ${{ inputs.sparse-checkout }}
5850
token: ${{ inputs.token || github.token }}
5951
persist-credentials: false
6052

61-
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
62-
if: inputs.persist-credentials == 'true'
53+
- if: inputs.persist-credentials == 'true'
54+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
6355
with:
56+
ref: ${{ inputs.ref == '' && github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || inputs.ref }}
6457
fetch-depth: ${{ inputs.fetch-depth }}
6558
lfs: ${{ inputs.lfs }}
6659
sparse-checkout: ${{ inputs.sparse-checkout }}
67-
ref: ${{ inputs.ref }}
6860
token: ${{ inputs.token || github.token }}
6961
persist-credentials: true
70-
71-
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
72-
if: inputs.persist-credentials != 'true'
73-
with:
74-
fetch-depth: ${{ inputs.fetch-depth }}
75-
lfs: ${{ inputs.lfs }}
76-
sparse-checkout: ${{ inputs.sparse-checkout }}
77-
ref: ${{ inputs.ref }}
78-
token: ${{ inputs.token || github.token }}
79-
persist-credentials: false

0 commit comments

Comments
 (0)