actions/example-pull-request: checkout gets the default branch
This commit is contained in:
parent
ee4a08f2b5
commit
600dee1abf
3 changed files with 21 additions and 2 deletions
|
@ -9,7 +9,7 @@ jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: code.forgejo.org/oci/debian:bookworm
|
image: code.forgejo.org/oci/node:20-bookworm
|
||||||
options: "--volume /srv/example-pull-request:/srv/example-pull-request"
|
options: "--volume /srv/example-pull-request:/srv/example-pull-request"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -120,3 +120,20 @@ jobs:
|
||||||
cat > $d/event <<'EOF'
|
cat > $d/event <<'EOF'
|
||||||
${{ toJSON(github.event) }}
|
${{ toJSON(github.event) }}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||||
|
- name: checkout the default branch if pull_request_target
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
case $GITHUB_EVENT_NAME in
|
||||||
|
pull_request_target)
|
||||||
|
! test -f file-unique-to-the-pr-branch
|
||||||
|
;;
|
||||||
|
pull_request)
|
||||||
|
test -f file-unique-to-the-pr-branch
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo unexpected event $GITHUB_EVENT_NAME
|
||||||
|
false
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
|
@ -18,6 +18,7 @@ function setup() {
|
||||||
git config user.email root@example.com
|
git config user.email root@example.com
|
||||||
git config user.name username
|
git config user.name username
|
||||||
echo fork $PROOF >> README
|
echo fork $PROOF >> README
|
||||||
|
touch file-unique-to-the-pr-branch
|
||||||
git add .
|
git add .
|
||||||
git commit -m 'fork change'
|
git commit -m 'fork change'
|
||||||
git push
|
git push
|
||||||
|
@ -32,6 +33,7 @@ function setup() {
|
||||||
git checkout -b other
|
git checkout -b other
|
||||||
git config user.email root@example.com
|
git config user.email root@example.com
|
||||||
git config user.name username
|
git config user.name username
|
||||||
|
touch file-unique-to-the-pr-branch
|
||||||
echo other $PROOF >> README
|
echo other $PROOF >> README
|
||||||
git add .
|
git add .
|
||||||
git commit -m 'other change'
|
git commit -m 'other change'
|
||||||
|
|
|
@ -10,7 +10,7 @@ runner:
|
||||||
insecure: false
|
insecure: false
|
||||||
fetch_timeout: 5s
|
fetch_timeout: 5s
|
||||||
fetch_interval: 2s
|
fetch_interval: 2s
|
||||||
labels: ["docker:docker://code.forgejo.org/oci/node:16-bullseye"]
|
labels: ["docker:docker://code.forgejo.org/oci/node:20-bookworm"]
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
Loading…
Add table
Reference in a new issue