Commit Graph
79 Commits
Author SHA1 Message Date
silverwind b0ec3fa4fc fmt 2026-02-24 08:17:17 +01:00
silverwindandClaude Opus 4.6 4fdf9ab904 Fix executor_test.go: ErrorIs arg order, wrong target, and data races
- TestNewParallelExecutorFailed: fix assert.ErrorIs argument order
- TestNewParallelExecutorCanceled: check for context.Canceled (not the
  executor error) since NewParallelExecutor returns ctx.Err() when
  context is cancelled; use atomic counter to fix data race
- TestNewParallelExecutor: use atomic counters to fix data race with
  concurrent goroutines

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-24 08:06:05 +01:00
silverwindandClaude Opus 4.6 1670945af3 Fix all 93 lint-go errors
Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-23 13:59:05 +01:00
Christopher Homberger bffc600775 fixes 2026-02-22 21:12:25 +01:00
Christopher Homberger a27473e6a8 fixes 2026-02-22 21:04:33 +01:00
Christopher Homberger a77f10683d assert => require 2026-02-22 21:00:42 +01:00
Christopher Homberger d187ac2fc1 auto adjust code 2026-02-22 20:58:46 +01:00
Christopher Homberger 3413919161 update import path 2026-02-22 20:54:58 +01:00
Christopher HombergerandChristopherHX 83cbf1f2b8 Port CI to Gitea.com (#1)
# Problems
- [x] Some env variables from act itself / act_runner let the tests fail.
- [ ] CI takes too long to clone actions, need to speed up the used act_runner by sparse checkout
    - Runners are reused this speeds up once every runner has ran every job
- [ ] Qemu setup is broken and do not add all platforms like GitHub CI expected`  linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/amd64/v4,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/loong64,linux/arm/v7,linux/arm/v6` got `linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/amd64/v4,linux/386` without qemu set up
  - Test Disabled
- [x] ACTIONS_RUNTIME_TOKEN needs to be unset
- [ ] Snapshot needs our version of the npm package / patching
  - Test Disabled
- [ ] ACTIONS_RESULTS_URL:http://127.0.0.1:12345/ seems to be a fallback to localhost this is a problem
  - Test Disabled

Reviewed-on: https://gitea.com/actions-oss/act-cli/pulls/1
Co-authored-by: Christopher Homberger <[email protected]>
Co-committed-by: Christopher Homberger <[email protected]>
2025-11-27 14:57:23 +00:00
ChristopherHXandGitHub fba76f10dd core(deps): bump golang-cilint to v2.0.2 (#83) 2025-04-25 21:58:30 +02:00
ChristopherHXandGitHub cef5575fa4 feat: Support graceful job step cancellation (#69)
* for gh-act-runner
* act-cli support as well
* respecting always() and cancelled() of steps
* setup-job, bug report, gh cli and watch wait call is cancelled early
2025-03-29 12:27:36 +01:00
ChristopherHXandGitHub d9a6d40f7c catch panic in finally (#68) 2025-03-24 23:22:43 +01:00
Steven EdwardsandGitHub 54f0cef40a Refactor findGitSlug to eliminate else ifs. (#41) 2025-01-30 11:42:24 -05:00
ChristopherHXandGitHub f28c532f35 misc: refactor logger of job setup and cleanup (#29)
* add support for additional json fields to output setup clean and pre stage step status
* fixes a finish job glitch as well
2025-01-29 17:18:45 +01:00
Steven EdwardsandGitHub 70c9e21c85 update go imports (#20)
* Replace nektos/act imports with actions-oss/act-cli

* Update go.mod to reference new repo

* Fix goimports "not properly formatted" complaints.

Replacing the imports left some out of alphabetical order.
2025-01-27 18:11:12 +01:00
ChristopherHXGitHubmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
b4ef6fb482 fix: short sha has at least four digits (#2540)
Currently it is not very unlikly to have a false match for tag `0` with sha `0XXXXXXXXXXXXXXXXXXXXXXX`, 1 to 16

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2024-12-24 21:33:13 +00:00
Casey LeeandGitHub 7172fc31d1 chore: upgrade dependencies (#2589)
* chore: upgrade dependencies

* fix: linter errors

* chore: bump version of golangci-lint

* chore: go mod tidy

* fix: failing test

* fix: update version of upload-artifact to v4

* chore: format test output with gotestfmt

* fix: typo in test exec

* fix: failing tests

* fix: windows unit test execution

* fix: windows unit test execution

* fix: whitespace
2024-12-24 13:12:24 -08:00
ChristopherHXandGitHub e1e5671e3d Actions Artifacts v4 backend (#2224)
* Actions Artifacts v4 backend

* lint

* fix it now

* remove protofile, to make linter not complain

* sync changes

* add delete

* import auth test from gitea

* add more tests

* codecov ignore protobuf
2024-05-20 20:00:04 +00:00
Yaroslav HalchenkoGitHubmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
843cd94cc2 Add codespell support (config, workflow to detect/not fix) and make it fix few typos (#2296)
* Add github action to codespell master on push and PRs

* Add codespell config with few custom skips

* [DATALAD RUNCMD] Do interactive fixing of  leftover ambigous typos

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "codespell -w -i 3 -C 2 ./pkg/common/git/git.go",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^

* exclude pkg/runner/hashfiles/index.js

* [DATALAD RUNCMD] run codespell throughout fixing typos automagically

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "codespell -w",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2024-04-19 09:22:45 +00:00
Jason SongandGitHub cdc22da7f0 Remove local action cache if remote has changed (#2284)
* fix: remove local cache if remote is changed

* test: TestCloneIfRequired
2024-04-10 12:41:02 +00:00
d9a19c8b02 Trivial: reduce log spam. (#2256)
Co-authored-by: ChristopherHX <[email protected]>
2024-03-28 23:28:48 +00:00
TKaxv_7SGitHubmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
f055d4ae60 feat: support offline mode (#2128)
* Add: Actions Offline Mode

* Add: Actions Offline Mode

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2024-01-20 00:20:15 +00:00
Casey LeeandGitHub 724ec918c9 chore: upgrade golangci-lint and address findings (#1904) 2023-07-10 17:12:12 -07:00
3ac2b726f2 Fix bug in processing jobs on platforms without Docker (#1834)
* Log incoming jobs.

Log the full contents of the job protobuf to make debugging jobs easier

* Ensure that the parallel executor always uses at least one thread.

The caller may mis-calculate the number of CPUs as zero, in which case
ensure that at least one thread is spawned.

* Use runtime.NumCPU for CPU counts.

For hosts without docker, GetHostInfo() returns a blank struct which
has zero CPUs and causes downstream trouble.

---------

Co-authored-by: Paul Armstrong <[email protected]>
Co-authored-by: Jason Song <[email protected]>
2023-06-06 03:00:54 +00:00
Jason SongGitHubmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
8518d70bdf feat: improve GetOutboundIP (#1707)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-03-31 13:28:08 +00:00
Jason SongGitHubmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1316307313 chore: use new style octal (#1630)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-02-16 15:34:51 +00:00
Alexandre LavigneandGitHub 7ebcc1c816 Feature/allow worktrees (#1530)
* Use go-git to find remote URL

* Use go-git package to resolve HEAD revision (commit sha1)

* Use go-git to find checked-out reference

* Remove unused functions
2023-01-19 06:29:23 +00:00
Eng Zer JunGitHubmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2f1c5a19f1 refactor: move from io/ioutil to io and os packages (#1417)
The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

[1]: https://golang.org/doc/go1.16#ioutil
Signed-off-by: Eng Zer Jun <[email protected]>

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-10-29 17:15:38 +00:00
Alex SavchukGitHubmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
48188a6280 fix: support docker create arguments from container.options (#1022) (#1351)
* fix: support docker create arguments from container.options (#1022)

* fix processing of errors, add verbose logging, fix test

* disable linter for code copied from docker/cli

* fix all linter issues

* Add license info

* Add opts_test.go from docker/cli and required testdata

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-10-06 22:09:43 +00:00
Björn BrauerGitHubMarkus Wolfmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
4391a10d5a Improve logging (#1171)
* feat: use logger from context wherever possible

Co-authored-by: Markus Wolf <[email protected]>

* feat: add step/job id and results to json logs

Co-authored-by: Markus Wolf <[email protected]>

* test: value to be masked should not be hard-coded in the action

Co-authored-by: Markus Wolf <[email protected]>

* fix: replace values following ::add-mask:: in evaluated strings

Co-authored-by: Markus Wolf <[email protected]>

* feat: [DEBUG] identifier for debug logs to distinguish them

Co-authored-by: Markus Wolf <[email protected]>

* feat: replace logger with step logger

The container gets injected a job logger, but during the time that steps
are run, we want to use the step logger.
This commit wraps pre/main/post steps in an executor that replaces the
job logger with a step logger.

Co-authored-by: Markus Wolf <[email protected]>

* feat: add pre/post stage identifier fields to json log output

Co-authored-by: Markus Wolf <[email protected]>

* feat: add job/step result status to skipped steps/jobs

Co-authored-by: Markus Wolf <[email protected]>

Co-authored-by: Markus Wolf <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-06-17 15:55:21 +00:00
RGitHubmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2aa0699aec refactor: remove github.com/pkg/errors dependency (#1077)
* refactor: split out common/git

* refactor: move git options to separate func

* refactor: remove github.com/pkg/errors dependency

* fix(golangci-lint): forbid github.com/pkg/errors

* style: fix typo

* style: fix typo

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-06-10 21:16:42 +00:00
RyanGitHubmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
d4272bd9fe feat: add option to specify git remote name (#1104)
fixes https://github.com/nektos/act/issues/1099
fixes https://github.com/nektos/act/issues/983

Signed-off-by: Ryan <[email protected]>

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-04-04 17:53:08 +00:00
Robert KowalskiGitHubCasey LeeBjörn Brauermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1e92d87b75 fix: remove unused TestContext (#1013)
The function `WithTestContext` is never called in the project, and
there is just one usage of `TestContext`, inside one of our loggers

Co-authored-by: Casey Lee <[email protected]>
Co-authored-by: Björn Brauer <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-03-14 17:47:16 +00:00
Markus WolfGitHubmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
18792f9620 feat: run jobs in parallel (#1003)
* feat: run jobs in parallel

This changes fixes and restructures the parallel execution of jobs.
The previous changes limiting the parallel execution did break this
and allowed only one job in parallel.

While we run #CPU jobs in parallel now, the jobs added per job-matrix
add to this. So we might over-commit to the capacity, but at least
it is limited.

* fix: correctly build job pipeline

The job pipeline should just append all required pipeline steps.
The parallelism will be handled by the ParallelExecutor and we
shouldn't handle it during building the pipelines.

Also this adds a test, that the ParallelExecutor does run
a limited amount of parallel goroutines.

* test: correct test implementation

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-25 18:47:16 +00:00
Björn BrauerGitHubmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
c24cfc72f4 Expression evaluator fixes (#1009)
* refactor: remove debug error output

Errors should always be logged with an error level and not debug level.
Since the error is returned here, it will be logged later as an error.
Presumably this was a leftover from debugging the executor chain in:
PR: #971

* refactor: debug log wich expression is going to be evaluated

* fix: handle nil in EvalBool

We've seen this issue when the env map is not set-up properly,
i.e. when the env map is nil, EvalBool might return nil, which should
be handled as a falsy value.

* fix: fail on error in if expression and return the evaluation error

Stop running the workflow in case an expression cannot be evaluated.

Fixes: #1008

* fix: remove quotes from inside expression syntax in test

It looks like having an expression inside double quotes inside the
expression syntax is not valid: https://github.com/ZauberNerd/act-test/actions/runs/1881986429
The workflow is not valid. .github/workflows/test.yml (Line: 10, Col: 13): Unexpected symbol: '"endsWith'. Located at position 1 within expression: "endsWith('Hello world', 'ld')"

* refactor: export IsTruthy function from exprparser package

* refactor: use IsTruthy function in EvalBool

* refactor: move debug log for expression rewrite to rewrite function

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-25 18:39:50 +00:00
ChristopherHXandGitHub 7dbf3fcb96 Fix: regression run after failure (#971)
* Fix: Regressions of run step after failure

* Add test, to enshure no panic

* Print error of failed step
2022-01-27 16:20:44 +00:00
1891c72ab1 fix: continue jobs + steps after failure (#840)
* fix: continue jobs + steps after failure

To allow proper if expression handling on jobs and steps (like always,
success, failure, ...) we need to continue running all executors in
the prepared chain.
To keep the error handling intact we add an occurred error to the
go context and handle it later in the pipeline/chain.

Also we add the job result to the needs context to give expressions
access to it.
The needs object, failure and success functions are split between
run context (on jobs) and step context.

Closes #442

Co-authored-by: Björn Brauer <[email protected]>

* style: correct linter warnings

Co-authored-by: Björn Brauer <[email protected]>

* fix: job if value defaults to success()

As described in the documentation, a default value of "success()" is
applied when no "if" value is present on the job.

https://docs.github.com/en/actions/learn-github-actions/expressions#job-status-check-functions

Co-authored-by: Markus Wolf <[email protected]>

* fix: check job needs recursively

Ensure job result includes results of previous jobs

Co-authored-by: Markus Wolf <[email protected]>

* test: add runner test for job status check functions

Co-authored-by: Markus Wolf <[email protected]>

* test: add unit tests for run context if evaluation

Co-authored-by: Björn Brauer <[email protected]>

* refactor: move if expression evaluation

Move if expression evaluation into own function (step context) to
better support unit testing.

Co-authored-by: Björn Brauer <[email protected]>

* test: add unit tests for step context if evaluation

Co-authored-by: Markus Wolf <[email protected]>

* fix: handle job error more resilient

The job error is not stored in a context map instead of a context
added value.
Since context values are immutable an added value requires to keep
the new context in all cases. This is fragile since it might slip
unnoticed to other parts of the code.

Storing the error of a job in the context map will make it more stable,
since the map is always there and the context of the pipeline is stable
for the whole run.

* feat: steps should use a default if expression of success()

* test: add integration test for if-expressions

* chore: disable editorconfig-checker for yaml multiline string

Co-authored-by: Björn Brauer <[email protected]>
Co-authored-by: Björn Brauer <[email protected]>
2021-12-08 20:57:42 +00:00
6517d04b9a feat: allow existing logger from context (#898)
We should reuse an existing context logger if in test context.
This will allow test to setup act with a null logger to assert
log messages.

Co-authored-by: Markus Wolf <[email protected]>

Co-authored-by: Markus Wolf <[email protected]>
2021-11-27 17:45:56 +00:00
62d2167f3b Fix github SSH regex for missing .git extension (#871)
* tests(pkg/common) add failing test case for SSH git URL

* fix(pkg/common) github SSH regex for missing .git extension

Co-authored-by: Ryan <[email protected]>
2021-11-13 14:56:31 +00:00
11f6ee37a6 Asset server implementation (#677)
* Add asset server and upload handling of binary files

Co-authored-by: Björn Brauer <[email protected]>

* Add asset download parts to the asset server

Co-authored-by: Björn Brauer <[email protected]>

* Add artifact-server-path flag

If the flag is not defined, the artifact server isn't started.
This includes the configuration of ACTIONS_RUNTIME_URL and
ACTIONS_RUNTIME_TOKEN which are set if the server is started.

Co-authored-by: Björn Brauer <[email protected]>

* Move ACTIONS_RUNTIME_* vars into the withGithubEnv setup

Co-authored-by: Björn Brauer <[email protected]>

* feat: add artifact server port as flag

This commits adds a flag to define the artifact server port.
If not given, the port defaults to 34567.

Co-authored-by: Björn Brauer <[email protected]>

* test: add artifact server tests

Co-authored-by: Björn Brauer <[email protected]>

* refactor: use fs.FS

This allows to add tests with in-memory file system

* feat: add support for gzip encoded uploads

Co-authored-by: Björn Brauer <[email protected]>

* test: add artifact integration test

* chore: run act tests with asset server path

Co-authored-by: Björn Brauer <[email protected]>

* docs: add new cli flags

Co-authored-by: Björn Brauer <[email protected]>

* test: add test workflow to testdata

* feat: add log output

* refactor: log shutdown error instead of panic

* feat: use outbound ip for the asset server

This change should allow to use the host ip in macos and windows.
Since docker is running in an intermediate vm, localhost is not
sufficient to have the artifacts in the host system.

* fix: do not use canceled context

To shutdown artifact server, we should not use the already canceled
context but the parent context instead.

Co-authored-by: Björn Brauer <[email protected]>

* feat: shutdown artifact server at end of pipeline

When the pipeline is done the asset server should be shut down
gracefully.

Co-authored-by: Björn Brauer <[email protected]>

* fix: close server if graceful shutdown failed

Co-authored-by: Björn Brauer <[email protected]>

* fix: ignore server closed error from listen call

Co-authored-by: Björn Brauer <[email protected]>

Co-authored-by: Björn Brauer <[email protected]>
Co-authored-by: Björn Brauer <[email protected]>
2021-11-10 09:57:22 -08:00
ChristopherHXGitHubmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
f0fd0af5ce Refresh hash after pull for branch refs (#791)
* Refresh hash after pull for branch refs

* Bump

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-09-08 16:47:12 +00:00
a9fe038347 Update images, fix extrapath (#723)
* fix: typo

* fix: remove debug for git references

it generates a massive amount of logs

* feat: read values from env

allows to test act on GHA when it's not a main repo

* fix: merge extrapath with PATH

* fix(tests): add additional shells for testing

* fix(image): update images

pin node to major version only, current node version: 12.22.1
replace most images with `node:12-buster-slim` to prevent
errors on macOS runner due to DockerHub pull limit
replace ocaml image

Co-authored-by: Casey Lee <[email protected]>
2021-06-10 23:12:05 +00:00
60b9606fc6 fix: use github auth token for pulling a repository (#693)
Co-Authored-By: Markus Wolf <[email protected]>

Co-authored-by: Markus Wolf <[email protected]>
2021-05-19 13:40:28 +00:00
Markus WolfGitHubBjörn Brauermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
38f6dfb49a fix: use auth when fetching (same as with cloning) (#687)
Co-authored-by: Björn Brauer <[email protected]>

Co-authored-by: Björn Brauer <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-05-18 06:25:07 +00:00
Ryan (hackercat)andGitHub aa68181f6b refactor: return more errors, add more tests (#679)
adding more tests
returns same message for short SHA format like GitHub Actions
refactor error checking
add more errors :)
2021-05-08 03:29:03 +00:00
Markus WolfandGitHub a07cb440c2 Write git clone progress only if terminal is a TTY (#670) 2021-05-06 06:55:23 -07:00
0c4374ec41 GitHub Enterprise support (#658)
* Add option to specify custom GitHub instance

* Use correct GHE API endpoint URLs

Co-authored-by: Markus Wolf <[email protected]>

* Extract slug from GitHub Enterprise URLs

Co-authored-by: Markus Wolf <[email protected]>

* Use GITHUB_TOKEN for clone authenticate if provided

This change will allow use authentication for cloning actions
from private repositories or github enterprise instances.

Co-Authored-By: Markus Wolf <[email protected]>

* Add section about using act on GitHub Enterprise to README

Co-authored-by: Markus Wolf <[email protected]>

* Set GitHubInstance in runnerConfig in runner_test

Co-authored-by: Markus Wolf <[email protected]>

Co-authored-by: hackercat <[email protected]>
Co-authored-by: Markus Wolf <[email protected]>
2021-05-05 09:42:34 -07:00
cec63488f3 Add super-linter + fix lint issues (#650)
* feat: bump `golangci-lint`, add `super-linter`, replace outdated linter

Bump `golangci-lint` version.
Add `super-linter` to lint other languages.
Go linter is disabled because it's currently broken:
https://github.com/github/super-linter/pull/370
Replacing `scopelint` with `exportloopref`: "[runner] The linter
'scopelint' is deprecated (since v1.39.0) due to: The repository of the
linter has been deprecated by the owner.  Replaced by exportloopref."
Fixed formatting in `.golangci.yml`
Add addtional linters:
  `misspell`: purely style, detects typos in comments
  `whitespace`: detects leading and trailing whitespace
  `goimports`: it's gofmt + checks unused imports

* fix: lint/fix `go` files

* fix: lint with `standardjs`

* fix: lint/fix with `markdownlint`, make template more verbose

* feat: add lint stuff to makefile

* fix: `UseGitIgnore` formatting

* fix: lint/fix `README.md`

Co-authored-by: Casey Lee <[email protected]>
2021-05-03 09:52:03 -07:00
Robert StuppandGitHub ea7503bc25 Prefer go-git to find the reference name (#633)
Walking the directory tree underneath `.git/refs` is not reliable, as it usually does not
return tags, especially for freshly cloned repos and/or tags fetched from a remote.

The go-git library provides an iterator over all git references.

This approach prefers a reference (tag, branch) from go-git, if found. If none is found,
it falls back to the previous implementation.
2021-05-03 07:32:00 -07:00
KADOTA, KyoheiandGitHub 010e459e95 Clean the repository cache if it is in incomplete state (#595) 2021-04-06 06:43:02 -07:00