actions: use the forgejo context instead of forge and test backward compatibility (#1034)
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/1034 Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org> 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
7f6f69c80f
commit
14d2748a33
5 changed files with 28 additions and 8 deletions
|
|
@ -22,6 +22,7 @@ jobs:
|
|||
test "$FORGEJO_ACTION" = "${{ env.FORGEJO_ACTION }}"
|
||||
test "$FORGEJO_ACTION" = "${{ github.ACTION }}"
|
||||
test "$FORGEJO_ACTION" = "${{ forge.ACTION }}"
|
||||
test "$FORGEJO_ACTION" = "${{ forgejo.ACTION }}"
|
||||
test "$FORGEJO_ACTION" = "$GITHUB_ACTION"
|
||||
|
||||
# See also actions/example-local-action/.forgejo/local-action/action.yml
|
||||
|
|
@ -32,6 +33,7 @@ jobs:
|
|||
test "$FORGEJO_ACTION_PATH" = "${{ env.FORGEJO_ACTION_PATH }}"
|
||||
test "$FORGEJO_ACTION_PATH" = "${{ github.ACTION_PATH }}"
|
||||
test "$FORGEJO_ACTION_PATH" = "${{ forge.ACTION_PATH }}"
|
||||
test "$FORGEJO_ACTION_PATH" = "${{ forgejo.ACTION_PATH }}"
|
||||
test "$FORGEJO_ACTION_PATH" = "$GITHUB_ACTION_PATH"
|
||||
|
||||
- name: when running an action
|
||||
|
|
@ -60,6 +62,7 @@ jobs:
|
|||
test "$FORGEJO_ACTOR" = "${{ env.FORGEJO_ACTOR }}"
|
||||
test "$FORGEJO_ACTOR" = "${{ github.ACTOR }}"
|
||||
test "$FORGEJO_ACTOR" = "${{ forge.ACTOR }}"
|
||||
test "$FORGEJO_ACTOR" = "${{ forgejo.ACTOR }}"
|
||||
test "$FORGEJO_ACTOR" = "$GITHUB_ACTOR"
|
||||
|
||||
- name: FORGEJO_API_URL
|
||||
|
|
@ -70,6 +73,7 @@ jobs:
|
|||
test "$FORGEJO_API_URL" = "${{ env.FORGEJO_API_URL }}"
|
||||
test "$FORGEJO_API_URL" = "${{ github.API_URL }}"
|
||||
test "$FORGEJO_API_URL" = "${{ forge.API_URL }}"
|
||||
test "$FORGEJO_API_URL" = "${{ forgejo.API_URL }}"
|
||||
test "$FORGEJO_API_URL" = "$GITHUB_API_URL"
|
||||
|
||||
# See also actions/example-pull-request/.forgejo/workflows/test.yml
|
||||
|
|
@ -80,6 +84,7 @@ jobs:
|
|||
test "$FORGEJO_BASE_REF" = "${{ env.FORGEJO_BASE_REF }}"
|
||||
test "$FORGEJO_BASE_REF" = "${{ github.BASE_REF }}"
|
||||
test "$FORGEJO_BASE_REF" = "${{ forge.BASE_REF }}"
|
||||
test "$FORGEJO_BASE_REF" = "${{ forgejo.BASE_REF }}"
|
||||
test "$FORGEJO_BASE_REF" = "$GITHUB_BASE_REF"
|
||||
|
||||
# See also actions/example-pull-request/.forgejo/workflows/test.yml
|
||||
|
|
@ -90,6 +95,7 @@ jobs:
|
|||
test "$FORGEJO_HEAD_REF" = "${{ env.FORGEJO_HEAD_REF }}"
|
||||
test "$FORGEJO_HEAD_REF" = "${{ github.HEAD_REF }}"
|
||||
test "$FORGEJO_HEAD_REF" = "${{ forge.HEAD_REF }}"
|
||||
test "$FORGEJO_HEAD_REF" = "${{ forgejo.HEAD_REF }}"
|
||||
test "$FORGEJO_HEAD_REF" = "$GITHUB_HEAD_REF"
|
||||
|
||||
- name: FORGEJO_ENV
|
||||
|
|
@ -106,6 +112,7 @@ jobs:
|
|||
test "$FORGEJO_EVENT_NAME" = "${{ env.FORGEJO_EVENT_NAME }}"
|
||||
test "$FORGEJO_EVENT_NAME" = "${{ github.EVENT_NAME }}"
|
||||
test "$FORGEJO_EVENT_NAME" = "${{ forge.EVENT_NAME }}"
|
||||
test "$FORGEJO_EVENT_NAME" = "${{ forgejo.EVENT_NAME }}"
|
||||
test "$FORGEJO_EVENT_NAME" = "$GITHUB_EVENT_NAME"
|
||||
|
||||
- name: FORGEJO_JOB
|
||||
|
|
@ -115,6 +122,7 @@ jobs:
|
|||
test "$FORGEJO_JOB" = "${{ env.FORGEJO_JOB }}"
|
||||
test "$FORGEJO_JOB" = "${{ github.JOB }}"
|
||||
test "$FORGEJO_JOB" = "${{ forge.JOB }}"
|
||||
test "$FORGEJO_JOB" = "${{ forgejo.JOB }}"
|
||||
test "$FORGEJO_JOB" = "$GITHUB_JOB"
|
||||
|
||||
- name: FORGEJO_OUTPUT
|
||||
|
|
@ -139,6 +147,7 @@ jobs:
|
|||
test "$FORGEJO_REF" = "${{ env.FORGEJO_REF }}"
|
||||
test "$FORGEJO_REF" = "${{ github.REF }}"
|
||||
test "$FORGEJO_REF" = "${{ forge.REF }}"
|
||||
test "$FORGEJO_REF" = "${{ forgejo.REF }}"
|
||||
test "$FORGEJO_REF" = "$GITHUB_REF"
|
||||
|
||||
- name: FORGEJO_REF_NAME
|
||||
|
|
@ -149,6 +158,7 @@ jobs:
|
|||
test "$FORGEJO_REF_NAME" = "${{ env.FORGEJO_REF_NAME }}"
|
||||
test "$FORGEJO_REF_NAME" = "${{ github.REF_NAME }}"
|
||||
test "$FORGEJO_REF_NAME" = "${{ forge.REF_NAME }}"
|
||||
test "$FORGEJO_REF_NAME" = "${{ forgejo.REF_NAME }}"
|
||||
test "$FORGEJO_REF_NAME" = "$GITHUB_REF_NAME"
|
||||
|
||||
- name: FORGEJO_REPOSITORY
|
||||
|
|
@ -158,6 +168,7 @@ jobs:
|
|||
test "$FORGEJO_REPOSITORY" = "${{ env.FORGEJO_REPOSITORY }}"
|
||||
test "$FORGEJO_REPOSITORY" = "${{ github.REPOSITORY }}"
|
||||
test "$FORGEJO_REPOSITORY" = "${{ forge.REPOSITORY }}"
|
||||
test "$FORGEJO_REPOSITORY" = "${{ forgejo.REPOSITORY }}"
|
||||
test "$FORGEJO_REPOSITORY" = "$GITHUB_REPOSITORY"
|
||||
|
||||
- name: FORGEJO_REPOSITORY_OWNER
|
||||
|
|
@ -167,6 +178,7 @@ jobs:
|
|||
test "$FORGEJO_REPOSITORY_OWNER" = "${{ env.FORGEJO_REPOSITORY_OWNER }}"
|
||||
test "$FORGEJO_REPOSITORY_OWNER" = "${{ github.REPOSITORY_OWNER }}"
|
||||
test "$FORGEJO_REPOSITORY_OWNER" = "${{ forge.REPOSITORY_OWNER }}"
|
||||
test "$FORGEJO_REPOSITORY_OWNER" = "${{ forgejo.REPOSITORY_OWNER }}"
|
||||
test "$FORGEJO_REPOSITORY_OWNER" = "$GITHUB_REPOSITORY_OWNER"
|
||||
|
||||
- name: FORGEJO_RUN_NUMBER
|
||||
|
|
@ -176,6 +188,7 @@ jobs:
|
|||
test "$FORGEJO_RUN_NUMBER" = "${{ env.FORGEJO_RUN_NUMBER }}"
|
||||
test "$FORGEJO_RUN_NUMBER" = "${{ github.RUN_NUMBER }}"
|
||||
test "$FORGEJO_RUN_NUMBER" = "${{ forge.RUN_NUMBER }}"
|
||||
test "$FORGEJO_RUN_NUMBER" = "${{ forgejo.RUN_NUMBER }}"
|
||||
test "$FORGEJO_RUN_NUMBER" = "$GITHUB_RUN_NUMBER"
|
||||
|
||||
- name: FORGEJO_RUN_ID
|
||||
|
|
@ -185,6 +198,7 @@ jobs:
|
|||
test "$FORGEJO_RUN_ID" = "${{ env.FORGEJO_RUN_ID }}"
|
||||
test "$FORGEJO_RUN_ID" = "${{ github.RUN_ID }}"
|
||||
test "$FORGEJO_RUN_ID" = "${{ forge.RUN_ID }}"
|
||||
test "$FORGEJO_RUN_ID" = "${{ forgejo.RUN_ID }}"
|
||||
test "$FORGEJO_RUN_ID" = "$GITHUB_RUN_ID"
|
||||
|
||||
- name: FORGEJO_SERVER_URL
|
||||
|
|
@ -195,6 +209,7 @@ jobs:
|
|||
test "$FORGEJO_SERVER_URL" = "${{ env.FORGEJO_SERVER_URL }}"
|
||||
test "$FORGEJO_SERVER_URL" = "${{ github.SERVER_URL }}"
|
||||
test "$FORGEJO_SERVER_URL" = "${{ forge.SERVER_URL }}"
|
||||
test "$FORGEJO_SERVER_URL" = "${{ forgejo.SERVER_URL }}"
|
||||
test "$FORGEJO_SERVER_URL" = "$GITHUB_SERVER_URL"
|
||||
|
||||
- name: FORGEJO_SHA
|
||||
|
|
@ -204,6 +219,7 @@ jobs:
|
|||
test "$FORGEJO_SHA" = "${{ env.FORGEJO_SHA }}"
|
||||
test "$FORGEJO_SHA" = "${{ github.SHA }}"
|
||||
test "$FORGEJO_SHA" = "${{ forge.SHA }}"
|
||||
test "$FORGEJO_SHA" = "${{ forgejo.SHA }}"
|
||||
test "$FORGEJO_SHA" = "$GITHUB_SHA"
|
||||
|
||||
- name: FORGEJO_STEP_SUMMARY
|
||||
|
|
@ -221,6 +237,7 @@ jobs:
|
|||
test "$FORGEJO_TOKEN" = "${{ env.FORGEJO_TOKEN }}"
|
||||
test "$FORGEJO_TOKEN" = "${{ github.TOKEN }}"
|
||||
test "$FORGEJO_TOKEN" = "${{ forge.TOKEN }}"
|
||||
test "$FORGEJO_TOKEN" = "${{ forgejo.TOKEN }}"
|
||||
test "$FORGEJO_TOKEN" = "$GITHUB_TOKEN"
|
||||
|
||||
- name: FORGEJO_WORKSPACE
|
||||
|
|
@ -230,6 +247,7 @@ jobs:
|
|||
test "$FORGEJO_WORKSPACE" = "${{ env.FORGEJO_WORKSPACE }}"
|
||||
test "$FORGEJO_WORKSPACE" = "${{ github.WORKSPACE }}"
|
||||
test "$FORGEJO_WORKSPACE" = "${{ forge.WORKSPACE }}"
|
||||
test "$FORGEJO_WORKSPACE" = "${{ forgejo.WORKSPACE }}"
|
||||
test "$FORGEJO_WORKSPACE" = "$GITHUB_WORKSPACE"
|
||||
|
||||
- name: RUNNER_ARCH
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ runs:
|
|||
test "$FORGEJO_ACTION_REPOSITORY" = "${{ env.FORGEJO_ACTION_REPOSITORY }}"
|
||||
test "$FORGEJO_ACTION_REPOSITORY" = "${{ github.ACTION_REPOSITORY }}"
|
||||
test "$FORGEJO_ACTION_REPOSITORY" = "${{ forge.ACTION_REPOSITORY }}"
|
||||
test "$FORGEJO_ACTION_REPOSITORY" = "${{ forgejo.ACTION_REPOSITORY }}"
|
||||
test "$FORGEJO_ACTION_REPOSITORY" = "$GITHUB_ACTION_REPOSITORY"
|
||||
touch /srv/example/example-context/FORGEJO_ACTION_REPOSITORY
|
||||
|
||||
|
|
@ -26,5 +27,6 @@ runs:
|
|||
[[ "$FORGEJO_ACTION_PATH" =~ action-for-context@main$ ]] || [[ "$FORGEJO_ACTION_PATH" =~ /[0-9a-f]{2}/[0-9a-f]{62}$ ]]
|
||||
test "$FORGEJO_ACTION_PATH" = "${{ github.ACTION_PATH }}"
|
||||
test "$FORGEJO_ACTION_PATH" = "${{ forge.ACTION_PATH }}"
|
||||
test "$FORGEJO_ACTION_PATH" = "${{ forgejo.ACTION_PATH }}"
|
||||
test "$FORGEJO_ACTION_PATH" = "$GITHUB_ACTION_PATH"
|
||||
touch /srv/example/example-context/FORGEJO_ACTION_PATH
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ jobs:
|
|||
#
|
||||
- uses: https://code.forgejo.org/forgejo/test-setup-forgejo-docker@main
|
||||
with:
|
||||
args: ${{ forge.workspace }}/SOMEFILE
|
||||
args: ${{ forgejo.workspace }}/SOMEFILE
|
||||
#
|
||||
# ... which then also exists in the job workspace
|
||||
# because both docker containers are automatically
|
||||
# sharing the volume that contains it.
|
||||
#
|
||||
- run: |
|
||||
test -f ${{ forge.workspace }}/SOMEFILE
|
||||
test -f ${{ forgejo.workspace }}/SOMEFILE
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@ jobs:
|
|||
steps:
|
||||
- uses: https://code.forgejo.org/forgejo/test-setup-forgejo-docker@main
|
||||
with:
|
||||
args: ${{ forge.workspace }}/SOMEFILE
|
||||
args: ${{ forgejo.workspace }}/SOMEFILE
|
||||
- run: |
|
||||
test -f ${{ forge.workspace }}/SOMEFILE
|
||||
test -f ${{ forgejo.workspace }}/SOMEFILE
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ jobs:
|
|||
run: |
|
||||
set -x
|
||||
test $FORGEJO_TOKEN = ${{ env.FORGEJO_TOKEN }}
|
||||
test $FORGEJO_TOKEN = ${{ forge.token }}
|
||||
test $FORGEJO_TOKEN = ${{ forgejo.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 "$FORGEJO_TOKEN" login $FORGEJO_SERVER_URL
|
||||
|
|
@ -27,7 +27,7 @@ jobs:
|
|||
- 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
|
||||
if test ${{ forgejo.event.pull_request.base.repo.full_name }} = ${{ forge.event.pull_request.head.repo.full_name }} ; then
|
||||
echo value=false >> $FORGEJO_OUTPUT
|
||||
else
|
||||
echo value=true >> $FORGEJO_OUTPUT
|
||||
|
|
@ -95,7 +95,7 @@ jobs:
|
|||
#
|
||||
# create an issue
|
||||
#
|
||||
base_repo=${{ forge.event.pull_request.base.repo.full_name }}
|
||||
base_repo=${{ forgejo.event.pull_request.base.repo.full_name }}
|
||||
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
|
||||
|
|
@ -133,7 +133,7 @@ jobs:
|
|||
|
||||
- name: save event
|
||||
run: |
|
||||
d=/srv/example/pull-request/contexts/${{ forge.event.pull_request.head.repo.owner.username }}/$FORGEJO_EVENT_NAME
|
||||
d=/srv/example/pull-request/contexts/${{ forgejo.event.pull_request.head.repo.owner.username }}/$FORGEJO_EVENT_NAME
|
||||
mkdir -p $d
|
||||
cat > $d/github <<'EOF'
|
||||
${{ toJSON(github) }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue