refactor: move act under internal

The runner is an application, not a library. `act/model` and
`act/exprparser` were the last packages anything outside this repository
consumed and they now live in actionslib, so nothing needs the rest of
`act` to be importable, and keeping it importable invites the coupling
that was just removed.

Import paths only, the files are unchanged.

Assisted-by: Codet:GPT-5.1-Codex
This commit is contained in:
Lunny Xiao
2026-08-07 21:40:48 -07:00
parent b66433e667
commit 825c6af07c
264 changed files with 93 additions and 93 deletions
@@ -0,0 +1,34 @@
name: local-reusable-workflow
on:
workflow_call:
inputs:
string_required:
required: true
type: string
bool_required:
required: true
type: boolean
number_required:
required: true
type: number
secrets:
secret:
required: true
outputs:
output:
value: ${{ jobs.reusable.outputs.output }}
jobs:
reusable:
runs-on: ubuntu-latest
outputs:
output: ${{ steps.gen.outputs.output }}
steps:
- name: check inputs and secret arrived
run: |
[ "${{ inputs.string_required }}" = "string" ]
[ "${{ inputs.bool_required }}" = "true" ]
[ "${{ inputs.number_required }}" = "1" ]
[ "${{ secrets.secret }}" = "keep_it_private" ]
- id: gen
run: echo "output=${{ inputs.string_required }}" >> $GITHUB_OUTPUT
@@ -0,0 +1,29 @@
on: push
jobs:
_:
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
MYGLOBALENV3: myglobalval3
steps:
- uses: actions/checkout@v4
- run: |
echo MYGLOBALENV1=myglobalval1 > $GITHUB_ENV
echo "::set-env name=MYGLOBALENV2::myglobalval2"
- uses: ./actions/script
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 }}
+31
View File
@@ -0,0 +1,31 @@
on: push
jobs:
# State saved in main (via the $GITHUB_STATE file and the ::save-state command) must surface
# as $STATE_* in the action's post step.
_:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./actions/script
with:
main: |
echo mystate2=mystateval > $GITHUB_STATE
echo "::save-state name=mystate3::mystateval"
post: |
[ "$STATE_mystate2" = "mystateval" ]
[ "$STATE_mystate3" = "mystateval" ]
# State must be isolated per action instance even when two steps use the same action.
test-id-collision-bug:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./actions/script
id: script
with:
main: echo mystate=val1 > $GITHUB_STATE
post: '[ "$STATE_mystate" = "val1" ]'
- uses: ./actions/script
id: pre-script
with:
main: echo mystate=val2 > $GITHUB_STATE
post: '[ "$STATE_mystate" = "val2" ]'
@@ -0,0 +1,21 @@
name: action1
description: action1
runs:
using: composite
steps:
- name: env.COMPOSITE_OVERRIDE != '1'
run: exit 1
if: env.COMPOSITE_OVERRIDE != '1'
shell: bash
- name: env.JOB != '1'
run: exit 1
if: env.JOB != '1'
shell: bash
- name: env.GLOBAL != '1'
run: exit 1
if: env.GLOBAL != '1'
shell: bash
- uses: ./act-composite-env-test/action2
env:
COMPOSITE_OVERRIDE: "2"
COMPOSITE: "1"
@@ -0,0 +1,21 @@
name: action2
description: actions2
runs:
using: composite
steps:
- name: env.COMPOSITE_OVERRIDE != '2'
run: exit 1
if: env.COMPOSITE_OVERRIDE != '2'
shell: bash
- name: env.COMPOSITE != '1'
run: exit 1
if: env.COMPOSITE != '1'
shell: bash
- name: env.JOB != '1'
run: exit 1
if: env.JOB != '1'
shell: bash
- name: env.GLOBAL != '1'
run: exit 1
if: env.GLOBAL != '1'
shell: bash
@@ -0,0 +1,13 @@
on: push
env:
GLOBAL: "1"
jobs:
test:
runs-on: ubuntu-latest
env:
JOB: "1"
steps:
- uses: actions/checkout@v2
- uses: ./act-composite-env-test/action1
env:
COMPOSITE_OVERRIDE: "1"
@@ -0,0 +1,5 @@
FROM alpine:3.24
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
@@ -0,0 +1,5 @@
name: 'Test'
description: 'Test'
runs:
using: 'docker'
image: 'Dockerfile'
@@ -0,0 +1,26 @@
#!/bin/sh
checkEnvVar() {
name=$1
value=$2
allowEmpty=$3
if [ -z "$value" ]; then
echo "Missing environment variable: $name"
exit 1
fi
if [ "$allowEmpty" != "true" ]; then
test=$(echo "$value" |cut -f 2 -d "=")
if [ -z "$test" ]; then
echo "Environment variable is empty: $name"
exit 1
fi
fi
echo "$value"
}
checkEnvVar "GITHUB_ACTION" "$(env |grep "GITHUB_ACTION=")" false
checkEnvVar "GITHUB_ACTION_REPOSITORY" "$(env |grep "GITHUB_ACTION_REPOSITORY=")" true
checkEnvVar "GITHUB_ACTION_REF" "$(env |grep "GITHUB_ACTION_REF=")" true
@@ -0,0 +1,5 @@
name: 'Test'
description: 'Test'
runs:
using: 'node24'
main: 'index.js'
@@ -0,0 +1,15 @@
function checkEnvVar({ name, allowEmpty }) {
if (
process.env[name] === undefined ||
(allowEmpty === false && process.env[name] === "")
) {
throw new Error(
`${name} is undefined` + (allowEmpty === false ? " or empty" : "")
);
}
console.log(`${name}=${process.env[name]}`);
}
checkEnvVar({ name: "GITHUB_ACTION", allowEmpty: false });
checkEnvVar({ name: "GITHUB_ACTION_REPOSITORY", allowEmpty: true /* allows to be empty for local actions */ });
checkEnvVar({ name: "GITHUB_ACTION_REF", allowEmpty: true /* allows to be empty for local actions */ });
@@ -0,0 +1,11 @@
name: actions-with-environment-and-context-tests
description: "Actions with environment (env vars) and context (expression) tests"
on: push
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: './actions-environment-and-context-tests/js'
- uses: './actions-environment-and-context-tests/docker'
@@ -0,0 +1 @@
FROM ubuntu:26.04
@@ -0,0 +1,4 @@
name: 'action1'
runs:
using: 'docker'
image: 'Dockerfile'
@@ -0,0 +1,13 @@
outputs:
customoutput:
value: my-customoutput-${{ steps.random-color-generator.outputs.SELECTED_COLOR }}
runs:
using: composite
steps:
- name: Set selected color
run: echo '::set-output name=SELECTED_COLOR::green'
id: random-color-generator
shell: bash
- name: fail
run: exit 1
shell: bash
@@ -0,0 +1,8 @@
# Container image that runs your code
FROM node:24-bookworm-slim
# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh
# Code file to execute when the docker container starts up (`entrypoint.sh`)
ENTRYPOINT ["/entrypoint.sh"]
@@ -0,0 +1,15 @@
name: 'Hello World'
description: 'Greet someone and record the time'
inputs:
who-to-greet: # id of input
description: 'Who to greet'
required: true
default: 'World'
outputs:
time: # id of output
description: 'The time we greeted you'
runs:
using: 'docker'
image: 'Dockerfile'
env:
WHOAMI: ${{ inputs.who-to-greet }}
+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh -l
echo "Hello $1"
time=$(date)
echo ::set-output name=time::$time
echo ::set-output name=whoami::$WHOAMI
echo "SOMEVAR=$1" >>$GITHUB_ENV
@@ -0,0 +1,8 @@
# Container image that runs your code
FROM node:24-bookworm-slim
# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh
# Code file to execute when the docker container starts up (`entrypoint.sh`)
ENTRYPOINT ["/entrypoint.sh"]
@@ -0,0 +1,17 @@
name: 'Hello World'
description: 'Greet someone and record the time'
inputs:
who-to-greet: # id of input
description: 'Who to greet'
required: true
default: 'World'
outputs:
time: # id of output
description: 'The time we greeted you'
runs:
using: 'docker'
image: 'Dockerfile'
env:
WHOAMI: ${{ inputs.who-to-greet }}
args:
- ${{ inputs.who-to-greet }}
+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh -l
echo "Hello $1"
time=$(date)
echo ::set-output name=time::$time
echo ::set-output name=whoami::$WHOAMI
echo "SOMEVAR=$1" >>$GITHUB_ENV
@@ -0,0 +1,16 @@
name: docker-url
author: nektos
description: testing
inputs:
who-to-greet:
description: who to greet
required: true
default: World
runs:
using: docker
image: docker://node:24-bookworm-slim
entrypoint: /bin/sh -c
env:
TEST: enabled
args:
- env
@@ -0,0 +1,2 @@
node_modules
package-lock.json
+13
View File
@@ -0,0 +1,13 @@
name: 'Hello World'
description: 'Greet someone and record the time'
inputs:
who-to-greet: # id of input
description: 'Who to greet'
required: true
default: 'World'
outputs:
time: # id of output
description: 'The time we greeted you'
runs:
using: 'node24'
main: 'index.js'
+14
View File
@@ -0,0 +1,14 @@
import {appendFileSync, readFileSync} from 'node:fs';
const nameToGreet = process.env['INPUT_WHO-TO-GREET'] || 'World';
console.log(`Hello ${nameToGreet}!`);
if (process.env.GITHUB_OUTPUT) {
appendFileSync(process.env.GITHUB_OUTPUT, `time=${new Date().toTimeString()}\n`);
}
let payload = {};
if (process.env.GITHUB_EVENT_PATH) {
payload = JSON.parse(readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'));
}
console.log(`The event payload: ${JSON.stringify(payload, undefined, 2)}`);
@@ -0,0 +1,5 @@
{
"name": "node24",
"private": true,
"type": "module"
}
+15
View File
@@ -0,0 +1,15 @@
name: 'script'
description: 'Run the shell scripts passed as inputs across the pre/main/post lifecycle'
inputs:
main:
description: 'shell script to run in the main step'
required: false
default: ''
post:
description: 'shell script to run in the post step'
required: false
default: ''
runs:
using: 'node24'
main: 'index.js'
post: 'post.js'
+9
View File
@@ -0,0 +1,9 @@
import {execFileSync} from 'node:child_process';
// Run the `main` input as a bash script; its stdout (workflow commands like
// ::set-output / ::save-state) and $GITHUB_ENV / $GITHUB_STATE writes are
// processed by the runner, exactly like the remote script action this replaces.
const script = process.env.INPUT_MAIN;
if (script) {
execFileSync('bash', ['-eo', 'pipefail', '-c', script], {stdio: 'inherit'});
}
@@ -0,0 +1,5 @@
{
"name": "script",
"private": true,
"type": "module"
}
+6
View File
@@ -0,0 +1,6 @@
import {execFileSync} from 'node:child_process';
const script = process.env.INPUT_POST;
if (script) {
execFileSync('bash', ['-eo', 'pipefail', '-c', script], {stdio: 'inherit'});
}
+40
View File
@@ -0,0 +1,40 @@
name: basic
on: push
env:
TEST: value
jobs:
check:
runs-on: ubuntu-latest
steps:
- run: '[[ "$(pwd)" == "${GITHUB_WORKSPACE}" ]]'
- run: echo ${{ env.TEST }} | grep value
- run: env
- uses: docker://node:24-bookworm-slim
with:
somekey: ${{ env.TEST }}
args: echo ${INPUT_SOMEKEY} | grep somevalue
- run: ls
- run: echo 'hello world'
- run: echo ${GITHUB_SHA} >> $(dirname "${GITHUB_WORKSPACE}")/sha.txt
- run: cat $(dirname "${GITHUB_WORKSPACE}")/sha.txt | grep ${GITHUB_SHA}
build:
runs-on: ubuntu-latest
needs: [check]
steps:
- uses: actions/checkout@v2
- uses: ./actions/action1
with:
args: echo 'build'
test:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: docker://node:24-bookworm-slim
with:
args: env
- uses: docker://node:24-bookworm-slim
with:
entrypoint: /bin/echo
args: ${{github.event_name}}
@@ -0,0 +1 @@
ref: refs/heads/master
@@ -0,0 +1,2 @@
[core]
bare = true
+8
View File
@@ -0,0 +1,8 @@
name: checkout
on: push
jobs:
checkout:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
+42
View File
@@ -0,0 +1,42 @@
name: basic
on: push
jobs:
build:
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
steps:
- name: TEST set-env
run: echo "::set-env name=foo::bar"
- name: TEST set-env (cont.)
run: echo $foo | grep bar
- name: TEST set-output
id: set_output
run: echo "::set-output name=zoo::zar"
- run: echo "::add-path::/zip"
- run: echo $PATH | grep /zip
- name: TEST conditional
if: steps.set_output.outputs.zoo
run: echo "::set-env name=cond_env::foo"
- name: TEST conditional (cont.)
run: echo $cond_env | grep foo
- name: TEST debug, warning, error
run: |
echo "::debug file=app.js,line=100,col=20::Hello debug!"
echo "::warning file=app.js,line=100,col=20::Hello warning!"
echo "::error file=app.js,line=100,col=30::Hello error!"
- name: TEST stop-commands
run: |
echo "::stop-commands::my-end-token"
echo "::set-env name=foo::baz"
echo $foo | grep bar
echo "::my-end-token::"
echo "::set-env name=foo::baz"
- name: TEST stop-commands (cont.)
run: echo $foo | grep baz
@@ -0,0 +1,14 @@
name: composite-fail-with-output
on: push
jobs:
test-for-output:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./actions/composite-fail-with-output
id: composite-fail-with-output
continue-on-error: true
- run: |
echo ${{steps.composite-fail-with-output.outputs.customoutput}}
exit ${{steps.composite-fail-with-output.outputs.customoutput == 'my-customoutput-green' && '0' || '1'}}
@@ -0,0 +1,30 @@
name: container-hostname
on: push
defaults:
run:
shell: bash
jobs:
with-hostname:
runs-on: ubuntu-latest
container:
image: node:24-bookworm-slim
options: "--hostname my.host.local --user 100:101"
steps:
- run: |
echo "UID: $(id -u)"
echo "GID: $(id -g)"
echo "HOST: $(uname -n)"
[[ "$(id -u)" == "100" ]] && [[ "$(id -g)" == "101" ]] && [[ "$(uname -n)" == "my.host.local" ]]
default-hostname:
runs-on: ubuntu-latest
container:
image: node:24-bookworm-slim
steps:
- run: |
echo "UID: $(id -u)"
echo "GID: $(id -g)"
echo "HOST: $(uname -n)"
[[ "$(id -u)" == "0" ]] && [[ "$(id -g)" == "0" ]] && [[ $(uname -n) ]] && [[ "$(uname -n)" != "my.host.local" ]]
+19
View File
@@ -0,0 +1,19 @@
name: Job Container
on: push
jobs:
with-volumes:
runs-on: ubuntu-latest
container:
image: node:24-bookworm-slim
volumes:
- my_docker_volume:/path/to/volume
- /path/to/nonexist/directory
- /proc/sys/kernel/random/boot_id:/current/boot_id
steps:
- run: |
set -e
test -d /path/to/volume
test "$(cat /proc/sys/kernel/random/boot_id)" = "$(cat /current/boot_id)"
test -d /path/to/nonexist/directory
+29
View File
@@ -0,0 +1,29 @@
name: defaults-run
on:
- push
defaults:
run:
shell: sh
jobs:
without-defaults:
runs-on: ubuntu-latest
steps:
- run: echo $SHELL | grep -v bash || exit 1
with-defaults:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: /tmp
steps:
- run: |
echo $SHELL | grep bash || exit 1
[ $(pwd) = /tmp ] || exit 2
override-in-step:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- run: echo $SHELL | grep -v bash || exit 1
shell: sh
@@ -0,0 +1,18 @@
on: push
jobs:
_:
runs-on: ubuntu-latest
steps:
- run: |
runs:
using: composite
steps:
- run: exit 1
shell: bash
if: env.LEAK_ENV != 'val'
shell: cp {0} action.yml
- uses: ./
env:
LEAK_ENV: val
- run: exit 1
if: env.LEAK_ENV == 'val'
@@ -0,0 +1,12 @@
on: push
jobs:
_:
runs-on: ubuntu-latest
steps:
- run: |
FROM node:24-bookworm-slim
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: ./
@@ -0,0 +1,10 @@
name: "action composite"
description: "action composite"
runs:
using: composite
steps:
# second post action should fail if executed (we do check on the exit code)
- uses: ./ensure-post-steps/action-post/
with:
fail: "true"
- uses: ./ensure-post-steps/action-post/
@@ -0,0 +1,11 @@
name: "action post"
description: "action post"
inputs:
fail:
description: "true if this should fail"
required: false
default: "false"
runs:
using: node24
main: "./main.js"
post: "./post.js"
@@ -0,0 +1,3 @@
if (process.env["INPUT_FAIL"] === "true") {
process.exit(1);
}
@@ -0,0 +1,8 @@
name: test
on: push
jobs:
second-post-step-should-fail:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./ensure-post-steps/action-composite/
+79
View File
@@ -0,0 +1,79 @@
name: env-and-path
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Append to $GITHUB_PATH"
run: |
echo "$HOME/someFolder" >> $GITHUB_PATH
- name: "Append some more to $GITHUB_PATH"
run: |
echo "$HOME/someOtherFolder" >> $GITHUB_PATH
- name: "Check PATH"
run: |
echo "${PATH}"
if [[ ! "${PATH}" =~ .*"$HOME/"someOtherFolder.*"$HOME/"someFolder.* ]]; then
echo "${PATH} doesn't match .*someOtherFolder.*someFolder.*"
exit 1
fi
- name: "Prepend"
run: |
if ls | grep -q 'called ls' ; then
echo 'ls was overridden already?'
exit 2
fi
path_add=$(mktemp -d)
cat > $path_add/ls <<LS
#!/bin/sh
echo 'called ls'
LS
chmod +x $path_add/ls
echo $path_add >> $GITHUB_PATH
- name: "Verify prepend"
run: |
if ! ls | grep -q 'called ls' ; then
echo 'ls was not overridden'
exit 2
fi
- name: "Write single line env to $GITHUB_ENV"
run: |
echo "KEY=value" >> $GITHUB_ENV
- name: "Check single line env"
run: |
if [[ "${KEY}" != "value" ]]; then
echo "${KEY} doesn't == 'value'"
exit 1
fi
- name: "Write single line env with more than one 'equals' signs to $GITHUB_ENV"
run: |
echo "KEY=value=anothervalue" >> $GITHUB_ENV
- name: "Check single line env"
run: |
if [[ "${KEY}" != "value=anothervalue" ]]; then
echo "${KEY} doesn't == 'value=anothervalue'"
exit 1
fi
- name: "Write multiline env to $GITHUB_ENV"
run: |
echo 'KEY2<<EOF' >> $GITHUB_ENV
echo value2 >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: "Check multiline line env"
run: |
if [[ "${KEY2}" != "value2" ]]; then
echo "${KEY2} doesn't == 'value'"
exit 1
fi
- name: "Write multiline env with UUID to $GITHUB_ENV"
run: |
echo 'KEY3<<ghadelimiter_b8273c6d-d535-419a-a010-b0aaac240e36' >> $GITHUB_ENV
echo value3 >> $GITHUB_ENV
echo 'ghadelimiter_b8273c6d-d535-419a-a010-b0aaac240e36' >> $GITHUB_ENV
- name: "Check multiline env with UUID to $GITHUB_ENV"
run: |
if [[ "${KEY3}" != "value3" ]]; then
echo "${KEY3} doesn't == 'value3'"
exit 1
fi
@@ -0,0 +1,13 @@
on: push
jobs:
_:
runs-on: ubuntu-latest
steps:
- run: |
echo "test<<World" > $GITHUB_ENV
echo "x=Thats really Weird" >> $GITHUB_ENV
echo "World" >> $GITHUB_ENV
- if: env.test != 'x=Thats really Weird'
run: exit 1
- if: env.x == 'Thats really Weird' # This assert is triggered by the broken impl of act
run: exit 1
+101
View File
@@ -0,0 +1,101 @@
name: environment-files
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Append to $GITHUB_PATH"
run: |
echo "$HOME/someFolder" >> $GITHUB_PATH
- name: "Append some more to $GITHUB_PATH"
run: |
echo "$HOME/someOtherFolder" >> $GITHUB_PATH
- name: "Check PATH"
run: |
echo "${PATH}"
if [[ ! "${PATH}" =~ .*"$HOME/"someOtherFolder.*"$HOME/"someFolder.* ]]; then
echo "${PATH} doesn't match .*someOtherFolder.*someFolder.*"
exit 1
fi
- name: "Prepend"
run: |
if ls | grep -q 'called ls' ; then
echo 'ls was overridden already?'
exit 2
fi
path_add=$(mktemp -d)
cat > $path_add/ls <<LS
#!/bin/sh
echo 'called ls'
LS
chmod +x $path_add/ls
echo $path_add >> $GITHUB_PATH
- name: "Verify prepend"
run: |
if ! ls | grep -q 'called ls' ; then
echo 'ls was not overridden'
exit 2
fi
- name: "Write single line env to $GITHUB_ENV"
run: |
echo "KEY=value" >> $GITHUB_ENV
- name: "Check single line env"
run: |
if [[ "${KEY}" != "value" ]]; then
echo "${KEY} doesn't == 'value'"
exit 1
fi
- name: "Write single line env with more than one 'equals' signs to $GITHUB_ENV"
run: |
echo "KEY=value=anothervalue" >> $GITHUB_ENV
- name: "Check single line env"
run: |
if [[ "${KEY}" != "value=anothervalue" ]]; then
echo "${KEY} doesn't == 'value=anothervalue'"
exit 1
fi
- name: "Write multiline env to $GITHUB_ENV"
run: |
echo 'KEY2<<EOF' >> $GITHUB_ENV
echo value2 >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: "Check multiline line env"
run: |
if [[ "${KEY2}" != "value2" ]]; then
echo "${KEY2} doesn't == 'value'"
exit 1
fi
- name: "Write multiline env with UUID to $GITHUB_ENV"
run: |
echo 'KEY3<<ghadelimiter_b8273c6d-d535-419a-a010-b0aaac240e36' >> $GITHUB_ENV
echo value3 >> $GITHUB_ENV
echo 'ghadelimiter_b8273c6d-d535-419a-a010-b0aaac240e36' >> $GITHUB_ENV
- name: "Check multiline env with UUID to $GITHUB_ENV"
run: |
if [[ "${KEY3}" != "value3" ]]; then
echo "${KEY3} doesn't == 'value3'"
exit 1
fi
- name: "Write single line output to $GITHUB_OUTPUT"
id: write-single-output
run: |
echo "KEY=value" >> $GITHUB_OUTPUT
- name: "Check single line output"
run: |
if [[ "${{ steps.write-single-output.outputs.KEY }}" != "value" ]]; then
echo "${{ steps.write-single-output.outputs.KEY }} doesn't == 'value'"
exit 1
fi
- name: "Write multiline output to $GITHUB_OUTPUT"
id: write-multi-output
run: |
echo 'KEY2<<EOF' >> $GITHUB_OUTPUT
echo value2 >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: "Check multiline output"
run: |
if [[ "${{ steps.write-multi-output.outputs.KEY2 }}" != "value2" ]]; then
echo "${{ steps.write-multi-output.outputs.KEY2 }} doesn't == 'value2'"
exit 1
fi
+21
View File
@@ -0,0 +1,21 @@
name: CI
on: push
jobs:
test:
runs-on: ubuntu-latest
env:
BUILD_DIR: ${{ github.workspace }}/build
steps:
- name: Dump
run: |
echo "$BUILD_DIR"
echo "$EXPECTED_BUILD_DIR"
echo "$GITHUB_WORKSPACE/build"
env:
EXPECTED_BUILD_DIR: ${{ github.workspace }}/build
- name: Test
run: |
[ "$BUILD_DIR" = "$EXPECTED_BUILD_DIR" ] && [ "$BUILD_DIR" = "$GITHUB_WORKSPACE/build" ]
env:
EXPECTED_BUILD_DIR: ${{ github.workspace }}/build
@@ -0,0 +1,12 @@
on: push
jobs:
a:
strategy:
matrix:
a:
- env:
key1: ${{'val'}}1
- ${{fromJSON('[{"env":{"key2":"val2"}},{"env":{"key3":"val3"}}]')}}
runs-on: ubuntu-latest
steps:
- run: exit ${{ (matrix.a.env.key2 == 'val2' || matrix.a.env.key1 == 'val1' || matrix.a.env.key3 == 'val3' ) && '0' || '1' }}
@@ -0,0 +1,14 @@
on: push
jobs:
a:
strategy:
matrix:
a:
- env:
key1: val1
${{insert}}:
key2: val2
${{ insert }}: ${{fromJSON('{"key3":"val3"}')}}
runs-on: ubuntu-latest
steps:
- run: exit ${{ (matrix.a.env.key2 == 'val2' && matrix.a.env.key1 == 'val1' && matrix.a.env.key3 == 'val3' ) && '0' || '1' }}
+79
View File
@@ -0,0 +1,79 @@
on: push
jobs:
evalm:
strategy:
matrix: |-
${{fromJson('
{
"A": [ "A", "B" ]
}
')}}
runs-on: ubuntu-latest
steps:
- name: Check if the matrix key A exists
run: |
echo $MATRIX
exit ${{matrix.A && '0' || '1'}}
env:
MATRIX: ${{toJSON(matrix)}}
_additionalInclude_0:
strategy:
matrix:
include:
- def: val
runs-on: ubuntu-latest
steps:
- name: Check if the matrix key A exists
run: |
echo $MATRIX
exit ${{matrix.def == 'val' && '0' || '1'}}
env:
MATRIX: ${{toJSON(matrix)}}
- run: |
echo "::set-output name=result::success"
id: result
outputs:
result: ${{ steps.result.outputs.result }}
_additionalInclude_1:
needs: _additionalInclude_0
if: always()
runs-on: ubuntu-latest
steps:
- name: Check if the matrix key A exists
run: |
echo $MATRIX
exit ${{needs._additionalInclude_0.outputs.result == 'success' && '0' || '1'}}
_additionalProperties_0:
strategy:
matrix:
x:
- 0
y:
- 0
z:
- 0
include:
- def: val
z: 0
runs-on: ubuntu-latest
steps:
- name: Check if the matrix key A exists
run: |
echo $MATRIX
exit ${{matrix.def == 'val' && matrix.x == 0 && matrix.y == 0 && matrix.z == 0 && '0' || '1'}}
env:
MATRIX: ${{toJSON(matrix)}}
- run: |
echo "::set-output name=result::success"
id: result
outputs:
result: ${{ steps.result.outputs.result }}
_additionalProperties_1:
needs: _additionalProperties_0
if: always()
runs-on: ubuntu-latest
steps:
- name: Check if the matrix key A exists
run: |
echo $MATRIX
exit ${{needs._additionalProperties_0.outputs.result == 'success' && '0' || '1'}}
+24
View File
@@ -0,0 +1,24 @@
on: push
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- run: |
echo '::set-output name=matrix::{"package": ["a", "b"]}'
id: r1
outputs:
matrix: ${{steps.r1.outputs.matrix}}
evalm:
needs:
- prepare
strategy:
matrix: |-
${{fromJson(needs.prepare.outputs.matrix)}}
runs-on: ubuntu-latest
steps:
- name: Check if the matrix key package exists
run: |
echo $MATRIX
exit ${{matrix.package && '0' || '1'}}
env:
MATRIX: ${{toJSON(matrix)}}
+29
View File
@@ -0,0 +1,29 @@
on: push
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- run: |
echo '::set-output name=matrix::["a", "b"]'
id: r1
outputs:
matrix: ${{steps.r1.outputs.matrix}}
helix: steady
evalm:
needs:
- prepare
strategy:
matrix:
${{needs.prepare.outputs.helix}}: |-
${{fromJson(needs.prepare.outputs.matrix)}}
runs-on: ubuntu-latest
steps:
- name: Check if the matrix key doesn't ends up unevaluated
run: |
echo $MATRIX
exit ${{matrix['${{needs.prepare.outputs.helix}}'] && '1' || '0'}}
env:
MATRIX: ${{toJSON(matrix)}}
- name: Check if the evaluated matrix key contains a value
run: |
exit ${{matrix[needs.prepare.outputs.helix] && '0' || '1'}}
+12
View File
@@ -0,0 +1,12 @@
name: fail
on: push
jobs:
build:
runs-on: ubuntu-latest
container:
image: node:24-bookworm-slim
env:
TEST_ENV: test-value
steps:
- run: echo ${TEST_ENV} | grep bazooka
+25
View File
@@ -0,0 +1,25 @@
name: if-env-act-test
on: push
jobs:
if_env_test:
name: Test if env.ACT matching
runs-on: ubuntu-latest
steps:
# Should RUN, since we are running in act
- name: Positive env.ACT match
if: ${{ env.ACT }}
shell: bash
run: |
echo "This workflow is run using act, continue!"
echo "ACT: $ACT"
exit 0
# Should SKIP, since we are running in act
- name: Negative env.ACT match
if: ${{ !env.ACT }}
shell: bash
run: |
echo "This should be skipped since this workflow is run using act, fail!"
echo "ACT: $ACT"
exit 1
+29
View File
@@ -0,0 +1,29 @@
on: push
jobs:
mytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - run: exit 1
- uses: ./
if: failure()
- run: echo Success
shell: bash
- run: echo Success
if: success()
shell: bash
- run: exit 1
shell: bash
- run: echo "Shouldn't run"
if: success()
shell: bash
- run: echo "Shouldn't run2"
shell: bash
- run: echo expected to run
if: failure()
shell: bash
next:
needs: mytest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
+21
View File
@@ -0,0 +1,21 @@
on:
workflow_dispatch:
inputs:
NAME:
description: "A random input name for the workflow"
type: string
required: true
SOME_VALUE:
description: "Some other input to pass"
type: string
required: true
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Test with inputs
run: |
[ -z "${{ github.event.inputs.SOME_INPUT }}" ] && exit 1 || exit 0
@@ -0,0 +1,8 @@
inputs:
test-env-input: {}
runs:
using: composite
steps:
- run: |
exit ${{ inputs.test-env-input == env.test-env-input && '0' || '1'}}
shell: bash
@@ -0,0 +1,15 @@
on: push
jobs:
test-inputs-via-env-context:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- uses: ./inputs-via-env-context
with:
test-env-input: ${{ env.test-env-input }}
env:
test-env-input: ${{ github.event_name }}/${{ github.run_id }}
- run: |
exit ${{ env.test-env-input == format('{0}/{1}', github.event_name, github.run_id) && '0' || '1' }}
env:
test-env-input: ${{ github.event_name }}/${{ github.run_id }}
+16
View File
@@ -0,0 +1,16 @@
name: missing
on: push
jobs:
second:
runs-on: ubuntu-latest
needs: first
steps:
- run: echo How did you get here?
shell: bash
standalone:
runs-on: ubuntu-latest
steps:
- run: echo Hello world
shell: bash
+8
View File
@@ -0,0 +1,8 @@
name: no event
jobs:
stuck:
runs-on: ubuntu-latest
steps:
- run: echo How did you get here?
shell: bash
+10
View File
@@ -0,0 +1,10 @@
name: no first
on: push
jobs:
second:
runs-on: ubuntu-latest
needs: first
steps:
- run: echo How did you get here?
shell: bash
+21
View File
@@ -0,0 +1,21 @@
name: issue-597
on: push
jobs:
my_first_job:
runs-on: ubuntu-latest
steps:
- name: My first false step
if: "endsWith('Should not', 'o1')"
run: exit 1
- name: My first true step
if: ${{endsWith('Hello world', 'ld')}}
run: echo "Renst the Octocat"
- name: My second false step
if: "endsWith('Should not evaluate', 'o2')"
run: exit 1
- name: My third false step
if: ${{endsWith('Should not evaluate', 'o3')}}
run: exit 1
+21
View File
@@ -0,0 +1,21 @@
name: issue-598
on: push
jobs:
my_first_job:
runs-on: ubuntu-latest
steps:
- name: My first false step
if: "endsWith('Hello world', 'o1')"
run: exit 1
- name: My first true step
if: "!endsWith('Hello world', 'od')"
run: echo "Renst the Octocat"
- name: My second false step
if: "endsWith('Hello world', 'o2')"
run: exit 1
- name: My third false step
if: "endsWith('Hello world', 'o2')"
run: exit 1
@@ -0,0 +1,13 @@
name: job-container-invalid-credentials
on: push
jobs:
fail-on-invalid-credentials:
runs-on: ubuntu-latest
container:
image: node:24-bookworm-slim
credentials:
username: "user"
password: "" # Empty password caused a crash in jobexecutor
steps:
- run: exit 0
@@ -0,0 +1,11 @@
name: job-container
on: push
jobs:
test:
runs-on: ubuntu-latest
container:
image: node:24-bookworm-slim
options: --user 1000
steps:
- run: echo PASS
+20
View File
@@ -0,0 +1,20 @@
name: job-container
on: push
jobs:
test:
runs-on: ubuntu-latest
container:
image: node:24-bookworm-slim
env:
TEST_ENV: test-value
steps:
- run: echo ${TEST_ENV} | grep test-value
test2:
runs-on: ubuntu-latest
container: node:24-bookworm-slim
steps:
- run: echo ${TEST_ENV} | grep test-value
env:
TEST_ENV: test-value
@@ -0,0 +1,15 @@
on:
push:
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: exit 0
assert:
needs: test
if: |
( always() && !cancelled() ) && (
( needs.test.result != 'success' || !success() ) )
runs-on: ubuntu-latest
steps:
- run: exit 1
+7
View File
@@ -0,0 +1,7 @@
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
-
- run: exit 0
+28
View File
@@ -0,0 +1,28 @@
on: push
jobs:
fail:
runs-on: ubuntu-latest
steps:
- run: exit 1
suc1:
if: success() || failure()
needs:
- fail
runs-on: ubuntu-latest
steps:
- run: exit 0
suc2:
if: success() || failure()
needs:
- fail
runs-on: ubuntu-latest
steps:
- run: exit 0
next:
needs:
- suc1
- suc2
runs-on: ubuntu-latest
steps:
- run: echo should never reach here
- run: exit 1
@@ -0,0 +1,9 @@
name: local-action-docker-url
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./actions/docker-url
@@ -0,0 +1,26 @@
name: local-action-dockerfile
on: push
defaults:
run:
shell: bash
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./actions/docker-local
id: dockerlocal
with:
who-to-greet: 'Mona the Octocat'
- run: '[[ "${{ env.SOMEVAR }}" == "Mona the Octocat" ]]'
- run: '[ "${SOMEVAR}" = "Not Mona" ] || exit 1'
env:
SOMEVAR: 'Not Mona'
- run: '[[ "${{ steps.dockerlocal.outputs.whoami }}" == "Mona the Octocat" ]]'
# Test if overriding args doesn't leak inputs
- uses: ./actions/docker-local-noargs
with:
args: ${{format('"{0}"', 'Mona is not the Octocat') }}
who-to-greet: 'Mona the Octocat'
- run: '[[ "${{ env.SOMEVAR }}" == "Mona is not the Octocat" ]]'
+11
View File
@@ -0,0 +1,11 @@
name: local-action-node24
on: push
jobs:
test-node24:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./actions/node24
with:
who-to-greet: 'Mona the Octocat'
@@ -0,0 +1,39 @@
inputs:
who-to-greet:
default: 'Mona the Octocat'
runs:
using: composite
steps:
# Test if GITHUB_ACTION_PATH is set correctly before all steps
- run: stat $GITHUB_ACTION_PATH/push.yml
shell: bash
- run: stat $GITHUB_ACTION_PATH/action.yml
shell: bash
- run: '[[ "$GITHUB_ACTION_REPOSITORY" == "" ]] && [[ "$GITHUB_ACTION_REF" == "" ]]'
shell: bash
- uses: ./actions/docker-local
id: dockerlocal
with:
who-to-greet: ${{inputs.who-to-greet}}
- run: '[[ "${{ env.SOMEVAR }}" == "${{inputs.who-to-greet}}" ]]'
shell: bash
- run: '[ "${SOMEVAR}" = "Not Mona" ] || exit 1'
shell: bash
env:
SOMEVAR: 'Not Mona'
- run: '[[ "${{ steps.dockerlocal.outputs.whoami }}" == "${{inputs.who-to-greet}}" ]]'
shell: bash
# Test if overriding args doesn't leak inputs
- uses: ./actions/docker-local-noargs
with:
args: ${{format('"{0}"', 'Mona is not the Octocat') }}
who-to-greet: ${{inputs.who-to-greet}}
- run: '[[ "${{ env.SOMEVAR }}" == "Mona is not the Octocat" ]]'
shell: bash
# Test if GITHUB_ACTION_PATH is set correctly after all steps
- run: stat $GITHUB_ACTION_PATH/push.yml
shell: bash
- run: stat $GITHUB_ACTION_PATH/action.yml
shell: bash
- run: '[[ "$GITHUB_ACTION_REPOSITORY" == "" ]] && [[ "$GITHUB_ACTION_REF" == "" ]]'
shell: bash
@@ -0,0 +1,9 @@
name: local-action-dockerfile
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./local-action-via-composite-dockerfile
@@ -0,0 +1,3 @@
local-repositories:
https://github.com/nektos/test-override@a: testdata/actions/node24
nektos/test-override@b: testdata/actions/node24
@@ -0,0 +1,9 @@
name: basic
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: https://github.com/nektos/test-override@a
- uses: nektos/test-override@b
@@ -0,0 +1,12 @@
name: composite
description: composite
runs:
using: composite
steps:
- run: echo "secret value"
shell: bash
- run: echo "::add-mask::$(echo "abc" | base64)"
shell: bash
- run: echo "abc" | base64
shell: bash
+12
View File
@@ -0,0 +1,12 @@
name: mask-values
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: echo "::add-mask::secret value"
- run: echo "secret value"
- uses: ./mask-values/composite
- run: echo "YWJjCg=="
+16
View File
@@ -0,0 +1,16 @@
name: test
on: push
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
val: ["success", "failure"]
fail-fast: false
steps:
- name: test
run: |
echo "Expected job result: ${{ matrix.val }}"
[[ "${{ matrix.val }}" = "success" ]] || exit 1
@@ -0,0 +1,34 @@
name: matrix-with-user-inclusions
on: push
jobs:
build:
name: PHP ${{ matrix.os }} ${{ matrix.node}}
runs-on: ubuntu-latest
steps:
- run: |
echo ${NODE_VERSION} | grep 8
echo ${OS_VERSION} | grep ubuntu-18.04
env:
NODE_VERSION: ${{ matrix.node }}
OS_VERSION: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, macos-latest]
node: [4, 6, 8, 10]
exclude:
- os: macos-latest
node: 4
include:
- os: ubuntu-16.04
node: 10
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [8.x, 10.x, 12.x, 13.x]
steps:
- run: echo ${NODE_VERSION} | grep 8.x
env:
NODE_VERSION: ${{ matrix.node }}
+25
View File
@@ -0,0 +1,25 @@
name: matrix
on: push
jobs:
build:
name: PHP ${{ matrix.os }} ${{ matrix.node}}
runs-on: ${{ matrix.os }}
steps:
- run: echo ${NODE_VERSION} | grep ${{ matrix.node }}
env:
NODE_VERSION: ${{ matrix.node }}
strategy:
matrix:
os: [ubuntu-18.04, macos-latest]
node: [4, 6, 8, 10]
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [8.x, 10.x, 12.x, 13.x]
steps:
- run: echo ${NODE_VERSION} | grep ${{ matrix.node }}
env:
NODE_VERSION: ${{ matrix.node }}
+14
View File
@@ -0,0 +1,14 @@
name: test network setup
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Install tools
run: |
apt update
apt install -y iputils-ping
- name: Run hostname test
run: |
hostname -f
ping -c 4 $(hostname -f)
+26
View File
@@ -0,0 +1,26 @@
on:
push:
defaults:
run:
shell: sh
jobs:
test:
runs-on: self-hosted
steps:
- run: |
mkdir build
echo '#!/usr/bin/env sh' > build/testtool
echo 'echo Hi' >> build/testtool
chmod +x build/testtool
- run: |
echo '${{ tojson(runner) }}'
ls
echo '${{ github.workspace }}'
working-directory: ${{ github.workspace }}/build
- run: |
echo "$GITHUB_PATH"
echo '${{ github.workspace }}/build' > "$GITHUB_PATH"
cat "$GITHUB_PATH"
- run: |
echo "$PATH"
testtool
@@ -0,0 +1,21 @@
on: push
jobs:
local-invalid-step:
runs-on: ubuntu-latest
steps:
- run: |
runs:
using: composite
steps:
- name: Foo
- uses: Foo/Bar
shell: cp {0} action.yml
- uses: ./
local-missing-steps:
runs-on: ubuntu-latest
steps:
- run: |
runs:
using: composite
shell: cp {0} action.yml
- uses: ./
@@ -0,0 +1,7 @@
on: push
name: non-existent-action
jobs:
nopanic:
runs-on: ubuntu-latest
steps:
- uses: ./path/to/non-existent-action
+43
View File
@@ -0,0 +1,43 @@
name: output
on: push
jobs:
build_output:
runs-on: ubuntu-latest
steps:
- id: set_1
run: |
echo "::set-output name=var_1::$(echo var1)"
echo "::set-output name=var_2::$(echo var2)"
- id: set_2
run: |
echo "::set-output name=var_3::$(echo var3)"
- id: set_3
run: |
echo "::set-output name=var_4::$(echo var4)"
outputs:
variable_1: ${{ steps.set_1.outputs.var_1 }}
variable_2: ${{ steps.set_1.outputs.var_2 }}
variable_3: ${{ steps.set_2.outputs.var_3 }}
variable_4: ${{ steps.set_3.outputs.var_4 }}
build:
needs: build_output
runs-on: ubuntu-latest
steps:
- name: Check set_1 var1
run: |
echo "${{ needs.build_output.outputs.variable_1 }}"
echo "${{ needs.build_output.outputs.variable_1 }}" | grep 'var1' || exit 1
- name: Check set_1 var2
run: |
echo "${{ needs.build_output.outputs.variable_2 }}"
echo "${{ needs.build_output.outputs.variable_2 }}" | grep 'var2' || exit 1
- name: Check set_2 var3
run: |
echo "${{ needs.build_output.outputs.variable_3 }}"
echo "${{ needs.build_output.outputs.variable_3 }}" | grep 'var3' || exit 1
- name: Check set_3 var4
run: |
echo "${{ needs.build_output.outputs.variable_4 }}"
echo "${{ needs.build_output.outputs.variable_4 }}" | grep 'var4' || exit 1
+21
View File
@@ -0,0 +1,21 @@
name: output action
description: output action
inputs:
input:
description: some input
required: false
outputs:
job-output:
description: some output
value: ${{ steps.gen-out.outputs.step-output }}
runs:
using: composite
steps:
- name: run step
id: gen-out
run: |
echo "::set-output name=step-output::"
shell: bash
+39
View File
@@ -0,0 +1,39 @@
name: path tests
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Append to $GITHUB_PATH"
run: |
echo "/opt/hostedtoolcache/node/18.99/x64/bin" >> $GITHUB_PATH
- name: test path (after setup)
run: |
if ! echo "$PATH" |grep "/opt/hostedtoolcache/node/18.*/\(x64\|arm64\)/bin" ; then
echo "Node binaries not in path: $PATH"
exit 1
fi
- id: action-with-output
uses: ./path-handling/
- name: test path (after local action)
run: |
if ! echo "$PATH" |grep "/opt/hostedtoolcache/node/18.*/\(x64\|arm64\)/bin" ; then
echo "Node binaries not in path: $PATH"
exit 1
fi
- uses: ./path-handling/
with:
input: some input
- name: test path (after remote action)
run: |
if ! echo "$PATH" |grep "/opt/hostedtoolcache/node/18.*/\(x64\|arm64\)/bin" ; then
echo "Node binaries not in path: $PATH"
exit 1
fi
+10
View File
@@ -0,0 +1,10 @@
{
"pull_request": {
"head": {
"ref": "sample-head-ref"
},
"base": {
"ref": "sample-base-ref"
}
}
}
+26
View File
@@ -0,0 +1,26 @@
name: basic
on: pull_request
jobs:
build:
runs-on: ubuntu-latest
steps:
# test refs from event.json
- run: echo '${{github.ref}}'
- run: echo '${{github.head_ref}}' | grep sample-head-ref
- run: echo '${{github.base_ref}}' | grep sample-base-ref
# test main/composite context equality with data from event.json
- run: |
runs:
using: composite
steps:
- run: |
echo WORKFLOW_GITHUB_CONTEXT="$WORKFLOW_GITHUB_CONTEXT"
echo COMPOSITE_GITHUB_CONTEXT="$COMPOSITE_GITHUB_CONTEXT"
[[ "$WORKFLOW_GITHUB_CONTEXT" = "$COMPOSITE_GITHUB_CONTEXT" ]]
env:
WORKFLOW_GITHUB_CONTEXT: ${{ tojson(tojson(github.event)) }}
COMPOSITE_GITHUB_CONTEXT: ${{ '${{tojson(github.event)}}' }}
shell: bash
shell: cp {0} action.yml
- uses: ./
+2
View File
@@ -0,0 +1,2 @@
HELLO=WORLD
MULTILINE_ENV="foo\nbar\nbaz"
+3
View File
@@ -0,0 +1,3 @@
MY_SECRET=top-secret
MULTILINE_SECRET="foo\nbar\nbaz"
JSON_SECRET={"foo": "bar"}
+17
View File
@@ -0,0 +1,17 @@
name: basic
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: |
echo '${{secrets.MY_SECRET}}' | grep 'top-secret'
- run: |
echo "${{secrets.MULTILINE_SECRET}}" | wc -l | grep 3
- run: |
echo '${{secrets.JSON_SECRET}}' | grep "{\"foo\": \"bar\"}"
- run: |
echo '${{env.HELLO}}' | grep "WORLD"
- run: |
echo "${{env.MULTILINE_ENV}}" | wc -l | grep 3
@@ -0,0 +1,10 @@
name: services-empty-image
on: push
jobs:
test:
runs-on: ubuntu-latest
services:
db:
image: ${{ false && 'postgres:16' || '' }}
steps:
- run: echo "empty-image service was skipped"
@@ -0,0 +1,15 @@
name: services-with-containers
on: push
jobs:
services-with-containers:
runs-on: ubuntu-latest
# https://docs.github.com/en/actions/using-containerized-services/about-service-containers#running-jobs-in-a-container
container:
image: "node:24-bookworm-slim"
services:
nginx:
image: "nginx:alpine"
steps:
- run: apt-get -qq update && apt-get -yqq install --no-install-recommends curl
# reach the service over the shared job network by its alias, no host port needed
- run: curl -v http://nginx:80
+23
View File
@@ -0,0 +1,23 @@
name: services
on: push
jobs:
services:
name: Reproduction of failing Services interpolation
runs-on: ubuntu-latest
services:
postgres:
image: nginx:alpine
ports:
- 80
steps:
- name: Echo the Postgres service ID / Network / Ports
run: |
echo "id: ${{ job.services.postgres.id }}"
echo "network: ${{ job.services.postgres.network }}"
echo "ports: ${{ job.services.postgres.ports }}"
- name: The job context describes the started containers
run: |
test -n "${{ job.container.id }}"
test -n "${{ job.services.postgres.id }}"
test -n "${{ job.services.postgres.ports['80'] }}"
test "${{ job.services.postgres.network }}" = "${{ job.container.network }}"
@@ -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'

Some files were not shown because too many files have changed in this diff Show More