1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-06 17:40:58 +00:00
Commit graph

133 commits

Author SHA1 Message Date
Earl Warren
ebc7758c1f
chore: s|github.com/nektos/act/pkg|code.forgejo.org/forgejo/runner/act| 2025-07-28 19:23:07 +02:00
Earl Warren
c377159121 chore: use the same .golangci.yml as the runner & gofumpt over gofmt (#206)
To prepare for a smooth merge in the runner codebase.

- run with --fix for gofumpt and golangci
- manual edits for
  - disabling useless package naming warning
  - rename variables that had underscore in their name
  - remove trailing else at the end of a few functions

Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/206
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>
2025-07-28 12:26:41 +00:00
Earl Warren
87d973b894 chore(tests): add coverage for ./pkg/runner (#202)
Only changes test files.

---

- remove tests specific to running on a host with no container
  they are the same as with the containers (TestRunEventHostEnvironment)
- prefix the name of the tests with a distinctive name to
  more easily run them together
- use code.forgejo.org/oci images whereever possible
- remove some tests that are either
  - difficult to understand (ancient bugs)
  - not yet well understood (related to reusable workflows)
  - depend on github (generation of workflows to be run on the fly
    e.g. updateTestIfWorkflow)
- fix the TestSanitizeNetworkAlias tests that were not run
  and make them easier to debug
- disable tests of options that are forbidden in Forgejo Actions
  (testdata/container-hostname/push.yml)

Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/202
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>
2025-07-28 06:18:46 +00:00
Earl Warren
53e26e56b1 fix: sum256 the container name so derivations do not overflow (#191)
For instance, the volume name derived from the workflow name may exceed the file system limit when the container name it is derived from is too long.

Fixes forgejo/runner#152

Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/191
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>
2025-07-25 09:44:25 +00:00
earl-warren
a157d24741 feat: use hashed uses string as cache dir name (#186)
Port of https://gitea.com/gitea/act/pulls/117

Refs forgejo/act#100

Co-authored-by: Jason Song <i@wolfogre.com>
Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/186
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2025-07-21 21:08:46 +00:00
Earl Warren
13ed94f5b7 feat!: add the validate argument to reading workflows (#180)
This is a followup of https://code.forgejo.org/forgejo/act/pulls/170 so that it is possible to read a workflow without validation. It is not uncommon for Forgejo to read a workflow just to extract a few information from it, knowing it has been validated before. It would be a performance regression if schema validation happened in these cases.

This is a port of https://github.com/nektos/act/pull/2717/files

It is a breaking change in the context of Forgejo and Forgejo runner because it will need to add the new `validate` argument when reading workflows.

Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/180
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>
2025-07-16 08:46:36 +00:00
Earl Warren
e069333f58 chore(docs): do not link to nektosact web page on validation error
The error messages however difficult to parse will have to stand
on their own.
2025-07-11 14:12:22 +02:00
Earl Warren
960b552ba9 feat: add enable-email-notifications to the schema 2025-07-11 14:12:22 +02:00
Earl Warren
5faf1bbc54 chore(tests): workflows are validated via a schema
This test was introduced by 61b7859f12
to verify a safeguard prevents a crash. With schema validation it is
caught at an earlier stage.
2025-07-11 14:12:22 +02:00
ChristopherHX
4453e1a834 fix: use non strict schema to allow some undefined behavior (#2524)
* fix: use non strict schema to allow some undefined behavior

* GitHub Actions doesn't use the newer strict schema in the service
* Tolerate more hallucinations

* Update workflow.go

* Update workflow.go

* Update pkg/model/workflow.go

Co-authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

---------

Co-authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit b52da6190c971733cdf3ffcef97cdbdce4ba42e5)
2025-07-11 14:12:22 +02:00
ChristopherHX
65ae238f17 feat: Validate GitHub Actions schema (#2416)
* feat: Validate GitHub Actions schema

**BREAKING** previously accepted workflows are now invalid

* update code

* fix tests

* Bump docker / fix lint

* fix test action due to moving the file

* remove unused function

* fix parsing additional functions

* fix allow int

* update docker dep, due to linter

(cherry picked from commit 64219df0f2155d75ffc4423dc93c1e80bb4740bc)

Conflicts:
	go.mod
	go.sum
	pkg/model/workflow.go

	trivial context conflict & go.mod upgrades
2025-07-11 14:12:22 +02:00
achyrva
3fe4f4fb7f [RDNF #16] Fix for issue 2232: Many lines of "Could not find any stages to run" on run (#2272) (#157)
https://github.com/nektos/act/pull/2272

* Initial commit

* Put the tests back

* Remove unnecessary checks

* Remove unneeded check and fix test code

---------

Co-authored-by: Jason Song <i@wolfogre.com>

Co-authored-by: Andreas Taylor <Andy4495@users.noreply.github.com>
Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/157
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: achyrva <achyrva@noreply.code.forgejo.org>
Co-committed-by: achyrva <achyrva@noreply.code.forgejo.org>
2025-07-02 13:53:35 +00:00
Earl Warren
fe19a1d47b feat: rename notifications control to enable-email-notifications (#152)
Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/152
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>
2025-06-17 08:55:44 +00:00
Earl Warren
01032808ea feat: add notifications control to the workflow (#151)
Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/151
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>
2025-06-14 15:42:32 +00:00
Slatian
5cf8d53087 Feature: Added an action type for the action.yaml that uses sh (#141)
Currently the only way to get pre and post actions is to go through the nodejs mechanism, which is quite wasteful when all one wants to do is run a couple of shell commands, I'm trying to get around this with this patch.

It works similar to the node* actions in that it supports `pre`, `main` and `post`.

It is different in that these strings are passed to the system shell using `sh -c` and execute similar to the composite run action with the shell set to `sh`.

Example action to make use of this patch: https://codeberg.org/slatian/test-action/src/branch/main/action.yaml

Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/141
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Slatian <baschdel@disroot.org>
Co-committed-by: Slatian <baschdel@disroot.org>
2025-06-14 15:31:32 +00:00
earl-warren
d90516fdc7 Merge pull request 'PR#6. [RDNF] fix: docker buildx cache restore not working, fix: function name in comment, fix: rootless permission bits (new actions cache)' (#122) from achyrva/act:nektos-into-forgejo-2 into main
Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/122
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2025-05-26 05:15:49 +00:00
huajin tong
2110aed6c7 fix function name in comment (#2240)
Signed-off-by: thirdkeyword <fliterdashen@gmail.com>
(cherry picked from commit 71ae39085eb9ed060ac55b45e55147489faaefa2)
2025-04-24 09:00:54 +00:00
Maxim Slipenko
230f450bc2 tests: add node and python in TestStep_ShellCommand 2025-04-20 08:31:25 +03:00
Maxim Slipenko
e97623bbaf feat: add node as shell type 2025-04-18 18:14:21 +03:00
Earl Warren
58966f5a8a chore(lint): fix lint errors
- upgrade to golangci-lint@v1.62.2
- make it renovate friendly
- remove most frequent lint check that are not of consequence (unused
  args, etc.)
- fix remaining lint errors
- add renovate custom manager to update the Makefile variable
2024-12-30 21:11:02 +00:00
Earl Warren
61b7859f12 [FORGEJO] when a workflow decode error happen, log and do not crash 2024-09-15 15:46:01 +02:00
Chongyi Zheng
a7c4e92822 Merge branch 'nektos/master' into bump-nektos 2024-02-17 13:19:51 -05:00
Josh Soref
79e54641f4 fix: improve warning about remote not found (#2169)
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2024-01-28 19:21:21 +00:00
胖梁
853c5a22a4 WorkflowDispatchConfig supports multiple yaml node kinds (#2123)
* WorkflowDispatchConfig supports ScalarNode and SequenceNode yaml node kinds

* Avoid using log.Fatal

* package slices is not in golang 1.20

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2024-01-20 14:07:36 +00:00
ChristopherHX
57a16ab0f7 feat: cli option to enable the new action cache (#1954)
* Enable the new action cache

* fix

* fix: CopyTarStream (Docker)

* suppress panic in test

* add a cli option for opt in

* fixups

* add package

* fix

* rc.Config nil in test???

* add feature flag

* patch

* Fix respect --action-cache-path

Co-authored-by: Björn Brauer <zaubernerd@zaubernerd.de>

* add remote reusable workflow to ActionCache

* fixup

---------

Co-authored-by: Björn Brauer <zaubernerd@zaubernerd.de>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2024-01-19 23:49:35 +00:00
raffis
0956a75aca feat: support runs-on labels and group (#2062)
Signed-off-by: Raffael Sahli <raffael.sahli@doodle.com>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
2023-11-12 19:46:38 +00:00
techknowlogick
756db53bab Merge nektos/act/v0.2.51 2023-09-24 15:09:26 -04:00
Oliver Bell
7a470ff949 feat: support node20 runtime (#1988)
* feat: support node20

* fix

* more fixes

* maybe final fixes?

* format
2023-09-15 02:24:46 +00:00
Nathan Shaaban
8b8f57896d fix: fail if no stages were found (#1970)
* fix: fail if no stages were found

Adds a warning message if act is cannot find any stages to run
with the filters provided.

Reproduction:
- run `act -j gibberish`

Desired behavior: some indication I did something silly
Actual behavior: no output, just exit with success.

As a human who often makes spelling mistakes,
it would be nice if act warned me what I was doing that was silly
rather than exiting apparently doing
nothing with no obvious indication
I did something wrong.

* Revert "fix: fail if no stages were found"

This reverts commit 226adf1c15cf4c01d516a05dc923507e6999978d.

* fix: fail if no stages were found

Errors if no stages were found with the given filters.
Prints out a helpful error message, pointing users
in the right place for how to specify which stage to run.

Reproduction:
- run `act -j gibberish`

Desired behavior: some indication I did something silly
Actual behavior: no output, just exit with success.

As a human who often makes spelling mistakes,
it would be nice if act warned me what I was doing that was silly
rather than exiting apparently doing
nothing with no obvious indication
I did something wrong.
2023-08-21 17:53:47 +00:00
ChristopherHX
fd5b21b7be feat: cmd support for windows (#1941)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-08-08 15:44:25 +00:00
Jason Song
fc7b3c5c43 Merge tag 'nektos/v0.2.49'
Conflicts:
	cmd/input.go
	go.mod
	go.sum
	pkg/exprparser/interpreter.go
	pkg/model/workflow.go
	pkg/runner/expression.go
	pkg/runner/job_executor.go
	pkg/runner/runner.go
2023-08-02 11:52:14 +08:00
Josh McCullough
0c1dc1e2f6 throw when invalid uses key is provided (#1804)
* throw if `uses` is invalid

* update JobType to return error

* lint

* put //nolint:dupl on wrong test

* update error message to remove end punctuation

* lint

* update remote job type check

* move if statement

* rm nolint:dupl ... we'll see how that goes

---------

Co-authored-by: Casey Lee <cplee@nektos.com>
2023-07-10 21:27:43 -07:00
psa
478b378cd6 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 <psa@users.noreply.gitea.com>
Co-authored-by: Jason Song <i@wolfogre.com>
2023-06-06 03:00:54 +00:00
Jason Song
441bf3e1a7 Merge tag 'nektos/v0.2.45' 2023-05-04 17:45:53 +08:00
Zettat123
3d11b7686d avoid using log.Fatal (#1759) 2023-04-25 02:09:54 +00:00
Zettat123
ba7ef95f06 Support specifying command for services (#50)
This PR is to support overwriting the default `CMD` command of `services` containers.

This is a Gitea specific feature and GitHub Actions doesn't support this syntax.

Reviewed-on: https://gitea.com/gitea/act/pulls/50
Reviewed-by: Jason Song <i@wolfogre.com>
Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-committed-by: Zettat123 <zettat123@gmail.com>
2023-04-23 14:55:17 +08:00
Jason Song
8d2c320f7a Avoid using log.Fatal in pkg/* (#1705)
* fix: common

* fix: in runner

* fix: decodeNode

* fix: GetMatrixes

* Revert "fix: common"

This reverts commit 6599803b6ae3b7adc168ef41b4afd4d89fc22f34.

* fix: GetOutboundIP

* test: fix cases

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-04-18 14:17:36 +00:00
ChristopherHX
2e9189a6e2 fix: ghc assignment typo (#1729)
* fix: ghc assignment typo

* fixup server_url
2023-04-13 14:09:29 +00:00
ChristopherHX
e71161acde fix: reusable workflow panic (#1728)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-04-13 13:47:59 +00:00
Markus Wolf
8b25ad4dbe fix: add server_url attribute to github context (#1727)
* fix: add `server_url` attribute to github context

The `server_urL` attribute was missing in the `github` context.
Previously it was exposed as environment variable only.

Closes #1726

* fix: also set `api_url` and `graphql_url` attributes
2023-04-13 13:09:28 +00:00
Jason Song
73d7678465 Avoid using log.Fatal in pkg/* (#39)
Follow https://github.com/nektos/act/pull/1705

Reviewed-on: https://gitea.com/gitea/act/pulls/39
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Jason Song <i@wolfogre.com>
Co-committed-by: Jason Song <i@wolfogre.com>
2023-04-07 16:31:03 +08:00
Zettat123
1c9e2c8b90 Support reusable workflow (#34)
Fix https://gitea.com/gitea/act_runner/issues/80
Fix https://gitea.com/gitea/act_runner/issues/85

To support reusable workflows, I made some improvements:
- read `yml` files from both `.gitea/workflows` and `.github/workflows`
- clone repository for local reusable workflows because the runner doesn't have the code in its local directory
- fix the incorrect clone url like `https://https://gitea.com`

Co-authored-by: Jason Song <i@wolfogre.com>
Reviewed-on: https://gitea.com/gitea/act/pulls/34
Reviewed-by: Jason Song <i@wolfogre.com>
Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-committed-by: Zettat123 <zettat123@gmail.com>
2023-03-29 13:59:22 +08:00
Jason Song
2b594e229d Merge tag 'nektos/v0.2.43'
Conflicts:
	pkg/container/docker_run.go
	pkg/runner/action.go
	pkg/runner/logger.go
	pkg/runner/run_context.go
	pkg/runner/runner.go
	pkg/runner/step_action_remote_test.go
2023-03-16 11:45:29 +08:00
Markus Wolf
8d098545de fix: correct ref and ref_name (#1672)
* fix: correct ref and ref_name

The ref in the GitHub context is always full qualified
(e.g. refs/heads/branch, refs/tags/v1).
The ref_name is the ref with the strippep prefix.
In case of pull_requests, this is the merge commit ref
(e.g. refs/pull/123/merge -> 123/merge).

* test: update test data
2023-03-09 20:03:13 +00:00
Zettat123
95e700e85d Fix missing ActionRunsUsingGo (#20)
- Allow `using: "go"` when unmarshalling YAML.
- Add `ActionRunsUsingGo` to returned errors.

Co-authored-by: Zettat123 <zettat123@gmail.com>
Reviewed-on: https://gitea.com/gitea/act/pulls/20
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Zettat123 <zettat123@noreply.gitea.io>
Co-committed-by: Zettat123 <zettat123@noreply.gitea.io>
2023-03-09 22:51:58 +08:00
Markus Wolf
943f347327 fix: update output handling for reusable workflows (#1521)
* fix: map job output for reusable workflows

This fixes the job outputs for reusable workflows. There is
a required indirection. Before this we took the outputs from
all jobs which is not what users express with the workflow
outputs.

* fix: remove double evaluation

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-02-23 22:34:47 +00:00
Josh Soref
bfe9d9f671 fix: tolerate workflow that needs a missing job (#1595) (#1619)
Change planner functions to return errors

This enables createStages to return `unable to build dependency graph`

Fix PlanEvent to properly report errors relating to events/workflows
2023-02-16 16:41:59 +00:00
Lunny Xiao
7a2e7a8a9e Support go run on action (#12)
Reviewed-on: https://gitea.com/gitea/act/pulls/12
Reviewed-by: Jason Song <i@wolfogre.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-02-15 16:10:15 +08:00
Shubh Bapna
e8f2d13c43 feat: allow overriding of GITHUB_ env variables (#1582)
* allow overriding of GITHUB_ env variables

* bug fix for overriding env vars with empty string

* revert step.go

* refactor github_context to prevent lint failures. added more setters

* added ability to override github env variables

* handled base and head ref
2023-02-03 19:35:49 +00:00
ChristopherHX
29756ec8f3 refactor: fix savestate in pre steps (#1466)
* refactor: fix savestate in pre steps

* fix pre steps collision

* fix tests

* remove

* enable tests

* Update pkg/runner/action.go

* Rename InterActionState to IntraActionState

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-12-15 17:08:31 +00:00