chore: s/GITHUB_*/FORGEJO_*/ & s/github./forge./ (#776)
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/776 Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Co-authored-by: Earl Warren <contact@earl-warren.org> Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
parent
49c2072cbe
commit
b67f9e1a70
10 changed files with 39 additions and 39 deletions
|
|
@ -17,45 +17,45 @@ jobs:
|
|||
shell: bash
|
||||
run: |
|
||||
set -x
|
||||
test $GITHUB_TOKEN = ${{ env.GITHUB_TOKEN }}
|
||||
test $GITHUB_TOKEN = ${{ forge.token }}
|
||||
test $FORGEJO_TOKEN = ${{ env.FORGEJO_TOKEN }}
|
||||
test $FORGEJO_TOKEN = ${{ forge.token }}
|
||||
export DEBIAN_FRONTEND=noninteractive ; apt-get -qq update ; apt-get install -y -qq curl git >& /dev/null
|
||||
curl -sS -o /usr/local/bin/forgejo-curl.sh https://code.forgejo.org/forgejo/forgejo-curl/raw/branch/main/forgejo-curl.sh && chmod +x /usr/local/bin/forgejo-curl.sh
|
||||
forgejo-curl.sh --token "$GITHUB_TOKEN" login $GITHUB_SERVER_URL
|
||||
forgejo-curl.sh api_json $GITHUB_SERVER_URL/api/v1/user
|
||||
forgejo-curl.sh --token "$FORGEJO_TOKEN" login $FORGEJO_SERVER_URL
|
||||
forgejo-curl.sh api_json $FORGEJO_SERVER_URL/api/v1/user
|
||||
|
||||
- name: determine if the PR is from a fork
|
||||
id: forked
|
||||
run: |
|
||||
if test ${{ forge.event.pull_request.base.repo.full_name }} = ${{ forge.event.pull_request.head.repo.full_name }} ; then
|
||||
echo value=false >> $GITHUB_OUTPUT
|
||||
echo value=false >> $FORGEJO_OUTPUT
|
||||
else
|
||||
echo value=true >> $GITHUB_OUTPUT
|
||||
echo value=true >> $FORGEJO_OUTPUT
|
||||
fi
|
||||
|
||||
# See also actions/example-context/.forgejo/workflows/test.yml
|
||||
- name: env.GITHUB_BASE_REF
|
||||
- name: env.FORGEJO_BASE_REF
|
||||
run: |
|
||||
set -x
|
||||
test "$GITHUB_BASE_REF" = main
|
||||
test "$GITHUB_BASE_REF" = "${{ env.GITHUB_BASE_REF }}"
|
||||
test "$FORGEJO_BASE_REF" = main
|
||||
test "$FORGEJO_BASE_REF" = "${{ env.FORGEJO_BASE_REF }}"
|
||||
|
||||
# See also actions/example-context/.forgejo/workflows/test.yml
|
||||
- name: env.GITHUB_HEAD_REF
|
||||
- name: env.FORGEJO_HEAD_REF
|
||||
run: |
|
||||
set -x
|
||||
if ${{ steps.forked.outputs.value }} ; then
|
||||
test "$GITHUB_HEAD_REF" = main
|
||||
test "$FORGEJO_HEAD_REF" = main
|
||||
else
|
||||
test "$GITHUB_HEAD_REF" = other
|
||||
test "$FORGEJO_HEAD_REF" = other
|
||||
fi
|
||||
test "$GITHUB_HEAD_REF" = "${{ env.GITHUB_HEAD_REF }}"
|
||||
test "$FORGEJO_HEAD_REF" = "${{ env.FORGEJO_HEAD_REF }}"
|
||||
|
||||
- name: secrets
|
||||
shell: bash
|
||||
run: |
|
||||
set -x
|
||||
case $GITHUB_EVENT_NAME in
|
||||
case $FORGEJO_EVENT_NAME in
|
||||
pull_request_target)
|
||||
#
|
||||
# all PRs: secrets
|
||||
|
|
@ -76,7 +76,7 @@ jobs:
|
|||
fi
|
||||
;;
|
||||
*)
|
||||
echo unexpected event $GITHUB_EVENT_NAME
|
||||
echo unexpected event $FORGEJO_EVENT_NAME
|
||||
false
|
||||
;;
|
||||
esac
|
||||
|
|
@ -96,8 +96,8 @@ jobs:
|
|||
# create an issue
|
||||
#
|
||||
base_repo=${{ forge.event.pull_request.base.repo.full_name }}
|
||||
forgejo-curl.sh api_json --data-raw '{"title":"ISSUE"}' $GITHUB_SERVER_URL/api/v1/repos/$base_repo/issues
|
||||
url=$(echo $GITHUB_SERVER_URL | sed -e "s|://|://$GITHUB_TOKEN@|")
|
||||
forgejo-curl.sh api_json --data-raw '{"title":"ISSUE"}' $FORGEJO_SERVER_URL/api/v1/repos/$base_repo/issues
|
||||
url=$(echo $FORGEJO_SERVER_URL | sed -e "s|://|://$FORGEJO_TOKEN@|")
|
||||
git clone $url/$base_repo base
|
||||
branch=B$RANDOM
|
||||
(
|
||||
|
|
@ -108,7 +108,7 @@ jobs:
|
|||
echo CHANGE >> README
|
||||
git add .
|
||||
git commit -m 'change'
|
||||
case $GITHUB_EVENT_NAME in
|
||||
case $FORGEJO_EVENT_NAME in
|
||||
pull_request_target|pull_request)
|
||||
#
|
||||
# repository write scope via http git passthrough
|
||||
|
|
@ -117,15 +117,15 @@ jobs:
|
|||
#
|
||||
# repository write scope via the API
|
||||
#
|
||||
assert_fail_if_forked forgejo-curl.sh api_json --data-raw '{"title":"PR","base":"main","head":"'$branch'"}' $GITHUB_SERVER_URL/api/v1/repos/$base_repo/pulls
|
||||
assert_fail_if_forked forgejo-curl.sh api_json --data-raw '{"color":"#ffffff","name":"labelname"}' $GITHUB_SERVER_URL/api/v1/repos/$base_repo/labels
|
||||
assert_fail_if_forked forgejo-curl.sh api_json --data-raw '{"title":"PR","base":"main","head":"'$branch'"}' $FORGEJO_SERVER_URL/api/v1/repos/$base_repo/pulls
|
||||
assert_fail_if_forked forgejo-curl.sh api_json --data-raw '{"color":"#ffffff","name":"labelname"}' $FORGEJO_SERVER_URL/api/v1/repos/$base_repo/labels
|
||||
#
|
||||
# See https://codeberg.org/forgejo/forgejo/issues/1525
|
||||
#
|
||||
! forgejo-curl.sh api_json --data-raw '{"new_branch_name":"B'$RANDOM'"}' $GITHUB_SERVER_URL/api/v1/repos/$base_repo/branches
|
||||
! forgejo-curl.sh api_json --data-raw '{"new_branch_name":"B'$RANDOM'"}' $FORGEJO_SERVER_URL/api/v1/repos/$base_repo/branches
|
||||
;;
|
||||
*)
|
||||
echo unexpected event $GITHUB_EVENT_NAME
|
||||
echo unexpected event $FORGEJO_EVENT_NAME
|
||||
false
|
||||
;;
|
||||
esac
|
||||
|
|
@ -133,7 +133,7 @@ jobs:
|
|||
|
||||
- name: save event
|
||||
run: |
|
||||
d=/srv/example/pull-request/contexts/${{ forge.event.pull_request.head.repo.owner.username }}/$GITHUB_EVENT_NAME
|
||||
d=/srv/example/pull-request/contexts/${{ forge.event.pull_request.head.repo.owner.username }}/$FORGEJO_EVENT_NAME
|
||||
mkdir -p $d
|
||||
cat > $d/github <<'EOF'
|
||||
${{ toJSON(github) }}
|
||||
|
|
@ -143,7 +143,7 @@ jobs:
|
|||
- name: checkout the default branch if pull_request_target
|
||||
run: |
|
||||
set -x
|
||||
case $GITHUB_EVENT_NAME in
|
||||
case $FORGEJO_EVENT_NAME in
|
||||
pull_request_target)
|
||||
! test -f file-unique-to-the-pr-branch
|
||||
;;
|
||||
|
|
@ -151,7 +151,7 @@ jobs:
|
|||
test -f file-unique-to-the-pr-branch
|
||||
;;
|
||||
*)
|
||||
echo unexpected event $GITHUB_EVENT_NAME
|
||||
echo unexpected event $FORGEJO_EVENT_NAME
|
||||
false
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue