forked from DA-TENSHI/SHINANOSKEY
-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (38 loc) · 1.01 KB
/
pre-checkout.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Pre checkout
on:
workflow_call:
outputs:
sha:
value: ${{ jobs.checkout.outputs.sha }}
description: Commit SHA
permissions:
contents: read
jobs:
checkout:
name: Checkout
runs-on: ubuntu-22.04
outputs:
sha: ${{ steps.checkout.outputs.commit }}
steps:
- name: Prepare
id: prepare
env:
event_name: ${{ github.event_name }}
pr_number: ${{ github.event.pull_request.number }}
default_ref: ${{ github.ref }}
run: |
if [[ "$event_name" == 'pull_request_target' ]]; then
if [[ -z "$pr_number" ]]; then
exit 1
fi
echo "ref=refs/pull/${pr_number}/merge" >> $GITHUB_OUTPUT
else
echo "ref=${default_ref}" >> $GITHUB_OUTPUT
fi
- name: Checkout
id: checkout
uses: actions/[email protected]
with:
persist-credentials: false
ref: ${{ steps.prepare.outputs.ref }}
fetch-depth: 1