Skip to content

Commit db7ab2c

Browse files
committed
feat(actions/checkout): add support for ref input
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
1 parent cacc612 commit db7ab2c

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

.github/dependabot.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@ updates:
3232

3333
- package-ecosystem: npm
3434
open-pull-requests-limit: 20
35-
directory: "/actions/parse-ci-reports"
35+
directories:
36+
- "/actions/**/*"
3637
schedule:
3738
interval: weekly
3839
day: friday
3940
time: "04:00"
40-
cooldown:
41-
default-days: 7
4241
groups:
4342
npm-dependencies:
4443
patterns:

actions/checkout/action.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ inputs:
2222
description: |
2323
Whether to enable sparse checkout and the list of files or directories to include in the checkout.
2424
See https://github.com/actions/checkout#usage
25+
ref:
26+
description: |
27+
The branch, tag or SHA to checkout. For pull requests, the ref is set to the merge ref of the PR.
28+
See https://github.com/actions/checkout#usage
2529
persist-credentials:
2630
description: |
2731
Whether to persist the token credentials in the Git config.
@@ -37,7 +41,7 @@ runs:
3741
using: "composite"
3842
steps:
3943
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
40-
if: github.event_name == 'issue_comment' && inputs.persist-credentials == 'true'
44+
if: inputs.ref == '' && github.event_name == 'issue_comment' && inputs.persist-credentials == 'true'
4145
with:
4246
ref: refs/pull/${{ github.event.issue.number }}/head
4347
fetch-depth: ${{ inputs.fetch-depth }}
@@ -46,7 +50,7 @@ runs:
4650
persist-credentials: true
4751

4852
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
49-
if: github.event_name == 'issue_comment' && inputs.persist-credentials != 'true'
53+
if: inputs.ref == '' && github.event_name == 'issue_comment' && inputs.persist-credentials != 'true'
5054
with:
5155
ref: refs/pull/${{ github.event.issue.number }}/head
5256
fetch-depth: ${{ inputs.fetch-depth }}
@@ -55,19 +59,21 @@ runs:
5559
persist-credentials: false
5660

5761
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
58-
if: github.event_name != 'issue_comment' && inputs.persist-credentials == 'true'
62+
if: inputs.persist-credentials == 'true'
5963
with:
6064
fetch-depth: ${{ inputs.fetch-depth }}
6165
lfs: ${{ inputs.lfs }}
6266
sparse-checkout: ${{ inputs.sparse-checkout }}
67+
ref: ${{ inputs.ref }}
6368
token: ${{ inputs.token || github.token }}
6469
persist-credentials: true
6570

6671
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
67-
if: github.event_name != 'issue_comment' && inputs.persist-credentials != 'true'
72+
if: inputs.persist-credentials != 'true'
6873
with:
6974
fetch-depth: ${{ inputs.fetch-depth }}
7075
lfs: ${{ inputs.lfs }}
7176
sparse-checkout: ${{ inputs.sparse-checkout }}
77+
ref: ${{ inputs.ref }}
7278
token: ${{ inputs.token || github.token }}
7379
persist-credentials: false

0 commit comments

Comments
 (0)