mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-08-14 06:51:52 +02:00
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:
+5
@@ -0,0 +1,5 @@
|
||||
FROM alpine:3.24
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
name: 'Test'
|
||||
description: 'Test'
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
Vendored
Executable
+26
@@ -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
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
name: 'Test'
|
||||
description: 'Test'
|
||||
runs:
|
||||
using: 'node24'
|
||||
main: 'index.js'
|
||||
+15
@@ -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'
|
||||
Reference in New Issue
Block a user