diff --git a/actions/example-pull-request/.forgejo/workflows/test.yml b/actions/example-pull-request/.forgejo/workflows/test.yml index a05f961..91a906d 100644 --- a/actions/example-pull-request/.forgejo/workflows/test.yml +++ b/actions/example-pull-request/.forgejo/workflows/test.yml @@ -24,15 +24,19 @@ jobs: forgejo-curl.sh --token "$GITHUB_TOKEN" login $GITHUB_SERVER_URL forgejo-curl.sh api_json $GITHUB_SERVER_URL/api/v1/user + - name: determine if the PR is from a fork + id: forked + run: | + if test ${{ github.event.pull_request.base.repo.full_name }} = ${{ github.event.pull_request.head.repo.full_name }} ; then + echo value=false >> $GITHUB_OUTPUT + else + echo value=true >> $GITHUB_OUTPUT + fi + - name: secrets shell: bash run: | set -x - if test ${{ github.event.pull_request.base.repo.full_name }} = ${{ github.event.pull_request.head.repo.full_name }} ; then - forked=false - else - forked=true - fi case $GITHUB_EVENT_NAME in pull_request_target) # @@ -41,7 +45,7 @@ jobs: test "${{ secrets.SECRET }}" ;; pull_request) - if $forked ; then + if ${{ steps.forked.outputs.value }} ; then # # PRs from forked repositories: no secrets # @@ -63,16 +67,11 @@ jobs: shell: bash run: | set -x - if test ${{ github.event.pull_request.base.repo.full_name }} = ${{ github.event.pull_request.head.repo.full_name }} ; then - forked=false - else - forked=true - fi function assert_fail_if_forked() { if "$@" ; then - ! $forked + ! ${{ steps.forked.outputs.value }} else - $forked + ${{ steps.forked.outputs.value }} fi } # @@ -118,6 +117,6 @@ jobs: run: | d=/srv/example-pull-request/${{ github.event.pull_request.head.repo.owner.username }}/$GITHUB_EVENT_NAME/${{ github.event.action }} mkdir -p $d - cat > $d/event < $d/event <<'EOF' ${{ toJSON(github.event) }} EOF