actions/example-pull-request: move is-forked to its own step
This commit is contained in:
parent
2db61b4f50
commit
ee4a08f2b5
1 changed files with 13 additions and 14 deletions
|
@ -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 <<EOF
|
||||
cat > $d/event <<'EOF'
|
||||
${{ toJSON(github.event) }}
|
||||
EOF
|
||||
|
|
Loading…
Add table
Reference in a new issue