@@ -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.
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 }}
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