1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-31 18:30:58 +00:00

refactor: GITHUB_ENV command / remove env.PATH (#1503)

* fix: GITHUB_ENV / PATH handling

* apply workaround

* add ctx to ApplyExtraPath

* fix: Do not leak step env in composite

See https://github.com/nektos/act/pull/1585 for a test

* add more tests

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
ChristopherHX 2023-02-04 14:35:13 +01:00 committed by GitHub
parent 89a74e2a74
commit 02e21de560
18 changed files with 176 additions and 64 deletions

View file

@ -0,0 +1,27 @@
on: push
jobs:
_:
runs-on: ubuntu-latest
env:
MYGLOBALENV3: myglobalval3
steps:
- run: |
echo MYGLOBALENV1=myglobalval1 > $GITHUB_ENV
echo "::set-env name=MYGLOBALENV2::myglobalval2"
- uses: nektos/act-test-actions/script@main
with:
main: |
env
[[ "$MYGLOBALENV1" = "${{ env.MYGLOBALENV1 }}" ]]
[[ "$MYGLOBALENV1" = "${{ env.MYGLOBALENV1ALIAS }}" ]]
[[ "$MYGLOBALENV1" = "$MYGLOBALENV1ALIAS" ]]
[[ "$MYGLOBALENV2" = "${{ env.MYGLOBALENV2 }}" ]]
[[ "$MYGLOBALENV2" = "${{ env.MYGLOBALENV2ALIAS }}" ]]
[[ "$MYGLOBALENV2" = "$MYGLOBALENV2ALIAS" ]]
[[ "$MYGLOBALENV3" = "${{ env.MYGLOBALENV3 }}" ]]
[[ "$MYGLOBALENV3" = "${{ env.MYGLOBALENV3ALIAS }}" ]]
[[ "$MYGLOBALENV3" = "$MYGLOBALENV3ALIAS" ]]
env:
MYGLOBALENV1ALIAS: ${{ env.MYGLOBALENV1 }}
MYGLOBALENV2ALIAS: ${{ env.MYGLOBALENV2 }}
MYGLOBALENV3ALIAS: ${{ env.MYGLOBALENV3 }}

View file

@ -8,6 +8,7 @@ jobs:
using: composite
steps:
- run: exit 1
shell: bash
if: env.LEAK_ENV != 'val'
shell: cp {0} action.yml
- uses: ./

View file

@ -0,0 +1,12 @@
on: push
jobs:
_:
runs-on: ubuntu-latest
steps:
- run: |
FROM ubuntu:latest
ENV PATH="/opt/texlive/texdir/bin/x86_64-linuxmusl:${PATH}"
ENV ORG_PATH="${PATH}"
ENTRYPOINT [ "bash", "-c", "echo \"PATH=$PATH\" && echo \"ORG_PATH=$ORG_PATH\" && [[ \"$PATH\" = \"$ORG_PATH\" ]]" ]
shell: mv {0} Dockerfile
- uses: ./

View file

@ -0,0 +1,15 @@
name: remote-action-js
on: push
jobs:
test:
runs-on: ubuntu-latest
container:
image: node:16-buster-slim
options: --user node
steps:
- uses: actions/hello-world-javascript-action@v1
with:
who-to-greet: 'Mona the Octocat'
- uses: cloudposse/actions/github/slash-command-dispatch@0.14.0

View file

@ -0,0 +1,15 @@
on: push
jobs:
_:
runs-on: ubuntu-latest
env:
MY_ENV: test
steps:
- run: exit 1
if: env.MY_ENV != 'test'
- run: echo "MY_ENV=test2" > $GITHUB_ENV
- run: exit 1
if: env.MY_ENV != 'test2'
- run: echo "MY_ENV=returnedenv" > $GITHUB_ENV
- run: exit 1
if: env.MY_ENV != 'returnedenv'

View file

@ -0,0 +1,24 @@
on: push
jobs:
_:
runs-on: ubuntu-latest
env:
MY_ENV: test
steps:
- run: exit 1
if: env.MY_ENV != 'test'
- run: |
runs:
using: composite
steps:
- run: exit 1
shell: bash
if: env.MY_ENV != 'val'
- run: echo "MY_ENV=returnedenv" > $GITHUB_ENV
shell: bash
shell: cp {0} action.yml
- uses: ./
env:
MY_ENV: val
- run: exit 1
if: env.MY_ENV != 'returnedenv'