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:
|
||||
runs-on: docker
|
||||
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"
|
||||
|
||||
steps:
|
||||
|
@ -120,3 +120,20 @@ jobs:
|
|||
cat > $d/event <<'EOF'
|
||||
${{ toJSON(github.event) }}
|
||||
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.name username
|
||||
echo fork $PROOF >> README
|
||||
touch file-unique-to-the-pr-branch
|
||||
git add .
|
||||
git commit -m 'fork change'
|
||||
git push
|
||||
|
@ -32,6 +33,7 @@ function setup() {
|
|||
git checkout -b other
|
||||
git config user.email root@example.com
|
||||
git config user.name username
|
||||
touch file-unique-to-the-pr-branch
|
||||
echo other $PROOF >> README
|
||||
git add .
|
||||
git commit -m 'other change'
|
||||
|
|
|
@ -10,7 +10,7 @@ runner:
|
|||
insecure: false
|
||||
fetch_timeout: 5s
|
||||
fetch_interval: 2s
|
||||
labels: ["docker:docker://code.forgejo.org/oci/node:16-bullseye"]
|
||||
labels: ["docker:docker://code.forgejo.org/oci/node:20-bookworm"]
|
||||
|
||||
cache:
|
||||
enabled: false
|
||||
|
|
Loading…
Add table
Reference in a new issue