diff --git a/actions/example-pull-request/.forgejo/workflows/test.yml b/actions/example-pull-request/.forgejo/workflows/test.yml index 91a906d..90e9fb4 100644 --- a/actions/example-pull-request/.forgejo/workflows/test.yml +++ b/actions/example-pull-request/.forgejo/workflows/test.yml @@ -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 diff --git a/actions/example-pull-request/run.sh b/actions/example-pull-request/run.sh index 78bbf22..2a88afd 100755 --- a/actions/example-pull-request/run.sh +++ b/actions/example-pull-request/run.sh @@ -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' diff --git a/actions/example-pull-request/runner-config.yaml b/actions/example-pull-request/runner-config.yaml index e9f4aeb..5c3a6b3 100644 --- a/actions/example-pull-request/runner-config.yaml +++ b/actions/example-pull-request/runner-config.yaml @@ -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