1
0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2026-10-24 16:59:19 +03:00

58 Commits

Author SHA1 Message Date
Mathieu Fenniak
1a633ad513 chore: prepare for runner v13 release (#1645)
Global search and replace of `runner/v12` for `runner/v13`.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1645): <!--number 1645 --><!--line 0 --><!--description Y2hvcmU6IHByZXBhcmUgZm9yIHJ1bm5lciB2MTMgcmVsZWFzZQ==-->chore: prepare for runner v13 release<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1645
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.code.forgejo.org>
2026-08-03 15:55:53 +00:00
Mathieu Fenniak
0cc27a9984 fix: nil dereference when EvaluateIf is called w/ cancelled() expr (#1633)
Fixes https://codeberg.org/forgejo/forgejo/issues/13503.

The existing implementation of `cancelled()` assumes that it is being invoked in a job execution context, not by the jobparser.  Because Forgejo doesn't attempt to check the `if` conditions of jobs during a workflow cancel, I didn't implement this case -- but overlooked that including the function in an expression was still possible if meaningless, and therefore didn't test it.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1633): <!--number 1633 --><!--line 0 --><!--description Zml4OiBuaWwgZGVyZWZlcmVuY2Ugd2hlbiBFdmFsdWF0ZUlmIGlzIGNhbGxlZCB3LyBjYW5jZWxsZWQoKSBleHBy-->fix: nil dereference when EvaluateIf is called w/ cancelled() expr<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1633
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.code.forgejo.org>
2026-07-18 13:08:19 +00:00
Andreas Ahlenstorf
16b8502407 chore: remove Gitea compatibility (#1611)
Since the introduction of [workflow validation](65ae238f17), Forgejo Runner would refuse running workflows that reference the `gitea` context. This change removes the remains of the Gitea support: the `gitea` context and some supporting variables like `GITEA_TOKEN`.

See https://codeberg.org/forgejo/discussions/issues/439 and https://code.forgejo.org/forgejo/runner/issues/1319.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1611): <!--number 1611 --><!--line 0 --><!--description Y2hvcmU6IHJlbW92ZSBHaXRlYSBjb21wYXRpYmlsaXR5-->chore: remove Gitea compatibility<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1611
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
2026-07-11 00:53:32 +00:00
Renovate Bot
3874a60871 Update module github.com/golangci/golangci-lint/v2/cmd/golangci-lint to v2.12.2 (#1613)
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [github.com/golangci/golangci-lint/v2/cmd/golangci-lint](https://github.com/golangci/golangci-lint) | `v2.11.4` โ†’ `v2.12.2` | ![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fgolangci%2fgolangci-lint%2fv2%2fcmd%2fgolangci-lint/v2.12.2?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fgolangci%2fgolangci-lint%2fv2%2fcmd%2fgolangci-lint/v2.11.4/v2.12.2?slim=true) |

---

### Release Notes

<details>
<summary>golangci/golangci-lint (github.com/golangci/golangci-lint/v2/cmd/golangci-lint)</summary>

### [`v2.12.2`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v2122)

[Compare Source](https://github.com/golangci/golangci-lint/compare/v2.12.1...v2.12.2)

*Released on 2026-05-06*

1. Linters bug fixes
   - `gomodguard_v2`: fix blocked configuration
   - `gomodguard_v2`: from 2.1.0 to 2.1.3
   - `iface`: from 1.4.1 to 1.4.2

### [`v2.12.1`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v2121)

[Compare Source](https://github.com/golangci/golangci-lint/compare/v2.12.0...v2.12.1)

*Released on 2026-05-01*

1. Linters bug fixes
   - `gomodguard_v2`: fix panic with migration suggestion
2. Misc.
   - fix `install.sh` script (if you are still using an URL based on the branch `master`, please update to use `https://golangci-lint.run/install.sh`)

### [`v2.12.0`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v2120)

[Compare Source](https://github.com/golangci/golangci-lint/compare/v2.11.4...v2.12.0)

*Released on 2026-05-01*

1. New linters
   - Add `clickhouselint` linter <https://github.com/ClickHouse/clickhouse-go-linter>
2. Linters new features or changes
   - `dupl`: from [`f665c8d`](https://github.com/golangci/golangci-lint/commit/f665c8d69b32) to [`c99c5cf`](https://github.com/golangci/golangci-lint/commit/c99c5cf5c202) (extended detection)
   - `funcorder`: from 0.5.0 to 0.6.0 (new option: `function`)
   - `goconst`: add an option to ignore strings from tests
   - `goconst`: from 1.8.2 to 1.10.0 (extended detection)
   - `gomodguard_v2`: from 1.4.1 to 2.1.0 (major version with new configuration)
   - `gosec`: from [`619ce21`](https://github.com/golangci/golangci-lint/commit/619ce2117e08) to 2.26.1 (new checks: `G124`, `G708`, `G709`, `G710`)
   - `govet`: add `inline` analyzer
   - `makezero`: from 2.1.0 to 2.2.1 (support slice type aliases)
   - `paralleltest`: expose `checkcleanup` option
   - `sloglint`: from 0.11.1 to 0.12.0 (new options: `allowed-keys`, `custom-funcs`)
   - `wsl_v5`: from 5.6.0 to 5.8.0 (new option: `cuddle-max-statements`; new checks: `after-decl`, `after-defer`, `after-expr`, `after-go`, `cuddle-group`)
3. Linters bug fixes
   - `forbidigo`: from 2.3.0 to 2.3.1
   - `godot`: from 1.5.4 to 1.5.6
   - `govet-modernize`: from 0.43.0 to 0.44.0
   - `ireturn`: from 0.4.0 to 0.4.1
   - `rowserrcheck`: from 1.1.1 to [`c5f79b8`](https://github.com/golangci/golangci-lint/commit/c5f79b8)
4. Misc.
   - Decrease cache entropy
   - Embed the JSON schema in the binary
   - Filter env vars when cloning the repository with the `custom` command

</details>

---

### Configuration

๐Ÿ“… **Schedule**: (UTC)

- Branch creation
  - Between 12:00 AM and 03:59 AM (`* 0-3 * * *`)
- Automerge
  - Between 12:00 AM and 03:59 AM (`* 0-3 * * *`)

๐Ÿšฆ **Automerge**: Enabled.

โ™ป **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

๐Ÿ”• **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNTIuMSIsInVwZGF0ZWRJblZlciI6IjQzLjI1Mi4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1613
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
2026-07-10 02:40:51 +00:00
gtker
2af96a754f feat(interpreter): Add support for case statements (#1590)
Implements https://code.forgejo.org/forgejo/forgejo-actions-feature-requests/issues/101.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1590): <!--number 1590 --><!--line 0 --><!--description ZmVhdChpbnRlcnByZXRlcik6IEFkZCBzdXBwb3J0IGZvciBgY2FzZWAgc3RhdGVtZW50cw==-->feat(interpreter): Add support for `case` statements<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: Gtker <dhh@logos.dk>
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1590
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.code.forgejo.org>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
2026-07-07 20:04:20 +00:00
Andreas Ahlenstorf
9a617b497b test: use flags instead of env variables for skipping tests (#1591)
https://code.forgejo.org/forgejo/runner/pulls/1585 introduced the environment variable `TEST_FEATURES` for switching tests related to particular feature on and off. For example, with `TEST_FEATURES=""`, tests that require Docker would be skipped. Unfortunately, that technique has multiple problems. Environment variables might not be passed on to child processes without it being clearly visible. Also, the usage differs by platform. On top of that, informational messages that are only related to testing were printed by the release binary.

Instead of the environment variable `TEST_FEATURES`, the command line flag `-features` is introduced:

```
$  go test ./... -args -features "docker,lxc"
```

That runs all tests that require the presence of Docker and LXC. It is also the default.

If tests that require Docker should be skipped, run:

```
$  go test ./... -args -features "lxc"
```

To exclude all tests that require the presence of a particular feature, run:

```
$  go test ./... -args -features "-"
```

At the moment, `-features` cannot be controlled when using make targets. That means that `make integration-test` runs all tests that require Docker or LXC.

Supersedes  https://code.forgejo.org/forgejo/runner/pulls/1588.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1591): <!--number 1591 --><!--line 0 --><!--description dGVzdDogdXNlIGZsYWdzIGluc3RlYWQgb2YgZW52IHZhcmlhYmxlcyBmb3Igc2tpcHBpbmcgdGVzdHM=-->test: use flags instead of env variables for skipping tests<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1591
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
2026-07-05 22:26:52 +00:00
Andreas Ahlenstorf
97f483db58 test: use environment variable for skipping Docker tests (#1585)
Tests involving Docker are skipped when `runtime.GOOS` is not `linux`. That is unnecessarily rigid and hinders development. There are other operating systems that can run Docker. It makes it impossible to run integration tests on Linux without Docker. Verifying that all tests that require Docker are skipped without Docker being present is impossible on Linux due to that, too.

Instead of relying on `runtime.GOOS`, developers can control whether tests involving Docker should be run with the help of the environment variable `TEST_FEATURES`.

If the variable is undefined, tests involving Docker will be run, because they are enabled by default:

```
$ make integration-test
```

That is the same as:

```
$ TEST_FEATURES="docker" make integration-test
```

If the variable does not contain the string `docker`, tests involving Docker will be **skipped**:

```
$ TEST_FEATURES="" make integration-test
```

If a test requires Docker, use `testutils.RequireTestFeatures(t, testutils.TestFeatureDocker)` to indicate that.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1585): <!--number 1585 --><!--line 0 --><!--description dGVzdDogdXNlIGVudmlyb25tZW50IHZhcmlhYmxlIGZvciBza2lwcGluZyBEb2NrZXIgdGVzdHM=-->test: use environment variable for skipping Docker tests<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1585
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
2026-07-03 14:52:02 +00:00
Mathieu Fenniak
1f6b35ba1c fix: expression evaluation fixes discovered while refactoring 'if' detection (#1572)
#1563 made changes to the `exprparser` library to allow detecting access to `env.*` and `secrets.*`.  Two bugs were discovered during failed refactoring efforts (#1566):
- `env.*` and `secrets.*` weren't detected as access; in the event that these expressions were used in an `if` block they wouldn't have caused Forgejo to defer execution to the runner rather than doing server-side `if` evaluation
- `toJSON(matrix)` outputs a wrapping `"Matrix"` element, which was missed when dynamic `runs-on` capabilities were added, but missed until tests triggered similar problems in `env`

More comprehensive unit test cases around both are fixed here.  Practically speaking neither bug is likely to occur in reality.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1572): <!--number 1572 --><!--line 0 --><!--description Zml4OiBleHByZXNzaW9uIGV2YWx1YXRpb24gZml4ZXMgZGlzY292ZXJlZCB3aGlsZSByZWZhY3RvcmluZyAnaWYnIGRldGVjdGlvbg==-->fix: expression evaluation fixes discovered while refactoring 'if' detection<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1572
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.code.forgejo.org>
2026-06-12 20:11:02 +00:00
Mathieu Fenniak
428a691ed0 feat(jobparser): implement jobparser capability to evaluate 'if' clauses (#1563)
The intent of this change is to allow Forgejo to evaluate `if` without having to send jobs to a runner.  When you send a job to a runner just for it to return "skipped!", it takes up 1 runner capacity for a `fetch_interval` period, which can be avoided if Forgejo can evaluate the `if` condition itself.

Creates a new `EvaluateIf` function in the jobparser library's `Job` which evaluates the `if` clause, with these conditions:
- Requires that the `Job` is parsed by `jobparser.Parse` and has parsing context, such as job inputs, job results.  If `Job` was serialized to yaml, then deserialized, this information would be missing and `EvaluateIf` would return an error.
- Accessing `env` and `secrets` is prohibited, and returns an error.  Forgejo will react to this specific error by falling back to the current behaviour: send the task to the runner for `if` to be evaluated on the runner.
    - `env` -- Currently Forgejo Runner can have configured [environment variables](22ebc7d1ab/internal/pkg/config/config.example.yaml (L26-L32)).  As these values wouldn't be known to Forgejo, it doesn't make sense to access `env` in an `if` block from Forgejo.
    - `secrets` -- Currently Forgejo doesn't provide secrets to the `jobparser`.  I think it's risky to change this -- giving this information to the jobparser opens the door for it to end up in a marshalled `SingleWorkflow` through some error or future change, and be stored in the database insecurely and unencrypted.

Forgejo's implementation using these new APIs is https://codeberg.org/forgejo/forgejo/pulls/13030.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1563): <!--number 1563 --><!--line 0 --><!--description ZmVhdChqb2JwYXJzZXIpOiBpbXBsZW1lbnQgam9icGFyc2VyIGNhcGFiaWxpdHkgdG8gZXZhbHVhdGUgJ2lmJyBjbGF1c2Vz-->feat(jobparser): implement jobparser capability to evaluate 'if' clauses<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1563
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.code.forgejo.org>
2026-06-11 21:08:03 +00:00
Andreas Ahlenstorf
c40664f26f fix: make look-up of matrix values case-insensitive when expanding workflows (#1553)
When expanding the workflow below, the job parser fails to resolve `${{ matrix.BUILD_TARGET }}`. The reason is that properties in workflows are supposed to be case insensitive. To accomplish that, map keys are converted to lowercase before looking them up. But the lookup in that particular case didn't take that into account and expected the map keys' casing to match, which it no longer did.

```yaml
on:
  push:
  workflow_dispatch:
jobs:
  one:
    runs-on: debian
    steps:
      - run: echo OK

  outer:
    strategy:
      matrix:
        BUILD_TARGET: ['a', 'b', 'c']
    uses: ./.forgejo/workflows/reusable.yaml
    with:
      build_param: ${{ matrix.BUILD_TARGET }}
```

Resolves https://codeberg.org/forgejo/forgejo/issues/12932.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1553): <!--number 1553 --><!--line 0 --><!--description Zml4OiBtYWtlIGxvb2stdXAgb2YgbWF0cml4IHZhbHVlcyBjYXNlLWluc2Vuc2l0aXZlIHdoZW4gZXhwYW5kaW5nIHdvcmtmbG93cw==-->fix: make look-up of matrix values case-insensitive when expanding workflows<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1553
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
2026-06-06 02:57:11 +00:00
Mathieu Fenniak
ac3c190811 feat: merge reusable expansion caller's 'if' into expanded jobs (#1509)
Fixes #1501.  As a jobparser upgrade, it requires Runner be released and Forgejo be upgraded to the new version.

When a reusable workflow caller has an `if:` condition on the job, it is placed on the expanded jobs that come from it.  If an inner job of a reusable workflow also has an `if:` condition, the two conditions are `&&`'d together.

I originally planned to evaluate the `if` condition during job parsing, as described in [a comment on #1501](https://code.forgejo.org/forgejo/runner/issues/1501#issuecomment-85822).  However, I realized that a common usage for `if` is job-status checks like `if: failed()`, and that cannot be evaluated at expansion time.

Manually tested with these workflows:

Caller:
```
on:
  pull_request:

jobs:
  top-true-inner-true:
    if: true
    uses: ./.forgejo/workflows/shared/child.yml
    with:
      value: first

  top-true-inner-false:
    if: true
    uses: ./.forgejo/workflows/shared/child.yml
    with:
      value: not first

  top-false:
    if: false
    uses: ./.forgejo/workflows/shared/child.yml
    with:
      value: would be second
```

Child:
```
name: Child workflow
on:
  workflow_call:
    inputs:
      value:
        type: string
        required: true

jobs:
  child-workflow:
    runs-on: docker
    if: ${{ inputs.value == 'first' }}
    steps:
      - name: Echo
        run: echo ${{ inputs.value }}
```

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1509): <!--number 1509 --><!--line 0 --><!--description ZmVhdDogbWVyZ2UgcmV1c2FibGUgZXhwYW5zaW9uIGNhbGxlcidzICdpZicgaW50byBleHBhbmRlZCBqb2Jz-->feat: merge reusable expansion caller's 'if' into expanded jobs<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1509
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.code.forgejo.org>
2026-05-05 01:00:02 +00:00
Andreas Ahlenstorf
1cc2af0e4a chore: incorporate go-git's gitignore matching (#1497)
Reduce Forgejo Runner's dependency on go-git further by incorporating its gitignore parsing and matching functionality into Forgejo Runner's source tree. Various alternative libraries were considered. However, those are either abandoned or have compatibility issues, or both.

Some unused functions in `dir.go` have been removed. go-git's internal abstractions were replaced with functionality provided by Go's standard library.

The original code can be found in 5b47ae8a22/plumbing/format/gitignore.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1497): <!--number 1497 --><!--line 0 --><!--description Y2hvcmU6IGluY29ycG9yYXRlIGdvLWdpdCdzIGdpdGlnbm9yZSBtYXRjaGluZw==-->chore: incorporate go-git's gitignore matching<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1497
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
2026-04-26 01:20:39 +00:00
Mathieu Fenniak
608f505d88 feat(jobparser): rewrite reusable workflow 'needs' references between jobs (#1217)
Reusable workflow expansion is a capability that will allow Forgejo to schedule every job of a reusable workflow as a separate job, allowing the use of multiple runners and clear independent logging.  This is a multi-PR implementation effort, project work tracking link: https://codeberg.org/forgejo/forgejo/issues/9768#issuecomment-8828016

This PR extends reusable workflow expansion such that if one job in a reusable workflow references another job via `${{ needs.some-job.outputs.some-output }}`, that expression is rewritten to reference the true ID of the job in the reusable workflow.  The expression would be mutated to `${{ needs[format('{0}.{1}', 'reusable-1', 'some-job')].outputs.some-output }}`, where `'reusable-1'` is the job ID of the parent/caller job.  With this change, jobs can reference each other, and are prevented from referencing other jobs in the workflow that aren't inside the scope of the reusable workflow.

In addition to test automation present here, this change has been manually tested on an [experimental Forgejo branch](https://codeberg.org/mfenniak/forgejo/pulls/3).

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1217): <!--number 1217 --><!--line 0 --><!--description ZmVhdChqb2JwYXJzZXIpOiByZXdyaXRlIHJldXNhYmxlIHdvcmtmbG93ICduZWVkcycgcmVmZXJlbmNlcyBiZXR3ZWVuIGpvYnM=-->feat(jobparser): rewrite reusable workflow 'needs' references between jobs<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1217
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-12-13 16:45:30 +00:00
Mathieu Fenniak
ca76b4ce12 feat(jobparser): allow access to the outputs of a reusable workflow (#1216)
Reusable workflow expansion is a capability that will allow Forgejo to schedule every job of a reusable workflow as a separate job, allowing the use of multiple runners and clear independent logging.  This is a multi-PR implementation effort, project work tracking link: https://codeberg.org/forgejo/forgejo/issues/9768#issuecomment-8828016

This PR extends reusable workflow expansion to support accessing the outputs of a reusable workflow.  Four changes are involved:
- Centralizing a duplicated `rewriteSubExpression` function between the jobparser and the runner.
- Creating an expression mutator which allows for transformations of expressions by their abstract syntax tree.
- Transforming the outputs in `on.workflow_call.outputs`, which are in the form of `jobs.some-job.outputs`, into `needs[format("{0}.{1}", parent-job-id, job-id)].outputs....` on the parent job.  This moves evaluation of the outputs into the placeholder job that was previously created in #1215 to support dependencies between jobs.
- Addition of a utility function `EvaluateWorkflowCallOutputs` which Forgejo can use to evaluate the outputs, as the placeholder job is never sent to a runner to be executed.
- Corrected an earlier persistent misuse of "callee" to refer to "caller".

In addition to test automation present here, this change has been manually tested on an [experimental Forgejo branch](https://codeberg.org/mfenniak/forgejo/pulls/3).

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1216): <!--number 1216 --><!--line 0 --><!--description ZmVhdChqb2JwYXJzZXIpOiBhbGxvdyBhY2Nlc3MgdG8gdGhlIG91dHB1dHMgb2YgYSByZXVzYWJsZSB3b3JrZmxvdw==-->feat(jobparser): allow access to the outputs of a reusable workflow<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1216
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-12-13 14:27:51 +00:00
Mathieu Fenniak
178c61fb44 feat(jobparser): support ${{ needs... }} in runs-on as IncompleteRunsOn (#1194)
**Note:** this PR is stacked on #1195.

Following the same pattern as #1190, this PR adds support for `${{ needs ... }}` within the `runs-on` field.  It also extends the support of the `runs-on: ${{ matrix... }}` to include matrixes that are dynamically defined per #1190.

Minor additional changes are required in Forgejo to: use the new `SupportIncompleteRunsOn()` parse option, mark jobs as blocked when they come back as `IncompleteRunsOn`, and add related error handling and test automation cases.

Together these changes allow the accurate parsing of these jobs that aren't supported currently:

```yaml
on:
  push:

jobs:
  define-matrix:
    runs-on: docker
    outputs:
      scalar-value: ${{ steps.define.outputs.scalar }}
      array-value: ${{ steps.define.outputs.array }}
    steps:
      - id: define
        run: |
          echo 'scalar=debian-ci-latest' >> "$FORGEJO_OUTPUT"
          echo 'array=["debian-latest", "debian-ci-latest"]' >> "$FORGEJO_OUTPUT"

  runs-on-needs:
    needs: define-matrix
    runs-on: ${{ needs.define-matrix.outputs.scalar-value }}
    steps:
      - run: uname -a

  runs-on-dynamic-matrix:
    needs: define-matrix
    strategy:
      matrix:
        runs-on:
          - debian-latest
          - "${{ needs.define-matrix.outputs.scalar-value }}"
    runs-on: ${{ matrix.runs-on }}
    steps:
      - run: uname -a
```

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1194): <!--number 1194 --><!--line 0 --><!--description ZmVhdChqb2JwYXJzZXIpOiBzdXBwb3J0ICR7eyBuZWVkcy4uLiB9fSBpbiBydW5zLW9uIGFzIEluY29tcGxldGVSdW5zT24=-->feat(jobparser): support ${{ needs... }} in runs-on as IncompleteRunsOn<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1194
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-12-01 15:42:16 +00:00
Mathieu Fenniak
faef7b71e3 feat(jobparser): enhance incomplete_matrix with information about what job & output was accessed (#1193)
It will be possible to report what `${{ needs... }}` value was referenced in a matrix that didn't exist, allowing better error messages in Forgejo.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1193): <!--number 1193 --><!--line 0 --><!--description ZmVhdChqb2JwYXJzZXIpOiBlbmhhbmNlIGluY29tcGxldGVfbWF0cml4IHdpdGggaW5mb3JtYXRpb24gYWJvdXQgd2hhdCBqb2IgJiBvdXRwdXQgd2FzIGFjY2Vzc2Vk-->feat(jobparser): enhance incomplete_matrix with information about what job & output was accessed<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1193
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-11-30 14:22:41 +00:00
Mathieu Fenniak
7acb2083b1 feat(jobparser): support referencing ${{ needs... }} variables in strategy.matrix (#1190)
https://code.forgejo.org/forgejo/forgejo-actions-feature-requests/issues/71 requires partial implementation in runner, and partial in Forgejo; this is the runner implementation.

Extends the jobparser module to support matrix jobs that reference the outputs of other needed jobs, for example:
```yaml
jobs:
  define-matrix:
    outputs:
      colors: ${{ steps.colors.outputs.colors }}
    steps:
      - name: Define Colors
        id: colors
        run: |
          echo 'colors=["red", "green", "blue"]' >> "$GITHUB_OUTPUT"
  produce-artifacts:
    needs: define-matrix
    strategy:
      matrix:
        color: ${{ fromJSON(needs.define-matrix.outputs.colors) }}
```

The intended workflow for `jobparser` to support this is:
- The workflow is passed to jobparser as usual, but the new `ParseOption` `WithJobOutputs()` is provided.  It can be an empty set of outputs at the beginning of a workflow.
- The `SingleWorkflow` that is returned may be tagged with `IncompleteMatrix: true`.  If so, this is a job that has `needs` that must be completed before its matrix can be evaluated.
- Later when the jobs listed in `needs` are complete, the `SingleWorkflow`'s content can be passed back to the jobparser with `WithJobOutputs()` that includes all of the needed jobs' outputs.  At this point the single job will be reevaluated and multiple jobs may be returned.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1190): <!--number 1190 --><!--line 0 --><!--description ZmVhdChqb2JwYXJzZXIpOiBzdXBwb3J0IHJlZmVyZW5jaW5nICR7eyBuZWVkcy4uLiB9fSB2YXJpYWJsZXMgaW4gYHN0cmF0ZWd5Lm1hdHJpeGA=-->feat(jobparser): support referencing ${{ needs... }} variables in `strategy.matrix`<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1190
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-11-28 15:41:26 +00:00
limiting-factor
c196605572 chore: bump version to v12 (#1176)
<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1176): <!--number 1176 --><!--line 0 --><!--description Y2hvcmU6IGJ1bXAgdmVyc2lvbiB0byB2MTI=-->chore: bump version to v12<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1176
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: limiting-factor <limiting-factor@posteo.com>
Co-committed-by: limiting-factor <limiting-factor@posteo.com>
2025-11-22 16:25:20 +00:00
Crown0815
da3a0ef1af Windows-specific-fixes (#1152)
This PR contains two fixes to the production code:

- 20d56ace53adf26f66e7eb14f3f899087aec70eb fixes the `hashFile` function in an action misinterpreting paths on Windows
- 4e2609329dc2e3e630a67c3237e38a92dd7dc784 fixes the `validate` command outputting full paths due to OS-unspecific path trimming logic

The remaining changes adopt tests to properly deal with

- Docker with Linux containers not being available on standard Windows runners c492fe121e2f2d2eb6dbc8fd5b1cef543437fa99
- Windows paths (6781d823683428d5cf8b9bac4753a458882b5994), (8ca14d0f4d4274e808fb027e021bac701279381e), (eb70aca72c89c08cdc03c35dd26f3e57bdeaacac), (4e2609329dc2e3e630a67c3237e38a92dd7dc784), (c00d4e0a81634c098086b822884eb6b525ebe933)
- Revert a change causing a test-runner panic on Windows (6608fec705f7e7ed48c7ffed3839f2b4c4c1defb)
- Exclude the daemon suicide test because it cannot be properly observed on Windows (3ef33b93b6c3422ce47325bc5330d2d954998cf4)

or in one case separate dedicated Windows and Linux test setups (709a1d3fdbfc8a6149a57fcf00570e842ef4d040)

I tried to keep the changes as minimal as possible and focussed on getting the tests to run again.
I only added skips for tests that I could not get to run due to the Docker requirements, or the different shutdown behaviors on Linux and Windows.

In the future, I will investigate why the defensive `chdir` in `linux_container_environment_extensions_test.go` (6608fec705f7e7ed48c7ffed3839f2b4c4c1defb) is necessary and whether I can get all of the docker tests (c492fe121e2f2d2eb6dbc8fd5b1cef543437fa99) to run on GitHub Actions

The passing of all tests on windows has been confirmed [here](https://github.com/Crown0815/Forgejo-runner-windows-builder/actions/runs/19344650459).

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1152): <!--number 1152 --><!--line 0 --><!--description V2luZG93cy1zcGVjaWZpYy1maXhlcw==-->Windows-specific-fixes<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: Felix Krรถner <felix.kroener@bruker.com>
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1152
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Crown0815 <crown0815@noreply.code.forgejo.org>
Co-committed-by: Crown0815 <crown0815@noreply.code.forgejo.org>
2025-11-16 15:56:57 +00:00
Andreas Ahlenstorf
3aa5603ed0 chore: rename NewInterpeter to NewInterpreter (#1119)
<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1119): <!--number 1119 --><!--line 0 --><!--description Y2hvcmU6IHJlbmFtZSBOZXdJbnRlcnBldGVyIHRvIE5ld0ludGVycHJldGVy-->chore: rename NewInterpeter to NewInterpreter<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1119
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Andreas Ahlenstorf <andreas@ahlenstorf.ch>
Co-committed-by: Andreas Ahlenstorf <andreas@ahlenstorf.ch>
2025-11-04 14:55:43 +00:00
Earl Warren
5c93da6fc7 feat: the forgejo context is equivalent to the github context (#999)
Resolves forgejo/runner#729

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/999): <!--number 999 --><!--line 0 --><!--description ZmVhdDogdGhlIGZvcmdlam8gY29udGV4dCBpcyBlcXVpdmFsZW50IHRvIHRoZSBnaXRodWIgY29udGV4dA==-->feat: the forgejo context is equivalent to the github context<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/999
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-09-15 09:14:11 +00:00
Earl Warren
8a7f760d3c chore: bump version to v11 (#940)
the license change from MIT to GPLv3+ is a breaking change

Refs forgejo/runner#773

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/940): <!--number 940 --><!--line 0 --><!--description Y2hvcmU6IGJ1bXAgdmVyc2lvbiB0byB2MTE=-->chore: bump version to v11<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/940
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-09-05 07:29:38 +00:00
Michael Kriese
27f425987c chore: modernize code (#857)
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/857
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Reviewed-by: Gusted <gusted@noreply.code.forgejo.org>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-committed-by: Michael Kriese <michael.kriese@visualon.de>
2025-08-15 04:54:13 +00:00
Earl Warren
931c2c0ac3 feat: added support for dereferenced map properties (#821)
Refs https://github.com/nektos/act/pull/2635

---

* Added support for dereferenced properties

* Added negative test

* Update pkg/exprparser/functions_test.go

Co-authored-by: ChristopherHX <christopher.homberger@web.de>

* Update pkg/exprparser/functions_test.go

Co-authored-by: ChristopherHX <christopher.homberger@web.de>

* fix lint

---------

Co-authored-by: m1r4c <lars-github@domesjo.com>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
(cherry picked from commit 20bb25432dd8db44c689a3bc2d440a648e71b3bb)

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/821): <!--number 821 --><!--line 0 --><!--description ZmVhdDogYWRkZWQgc3VwcG9ydCBmb3IgZGVyZWZlcmVuY2VkIG1hcCBwcm9wZXJ0aWVz-->feat: added support for dereferenced map properties<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: m1r4c <lars-github.com@domesjo.com>
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/821
Reviewed-by: Gusted <gusted@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-08-10 16:24:02 +00:00
Earl Warren
ec99579451 chore: to allow the runner to be imported, v9 needs to be in the go module (#777)
It will be imported by Forgejo.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/777): <!--number 777 --><!--line 0 --><!--description Y2hvcmU6IHRvIGFsbG93IHRoZSBydW5uZXIgdG8gYmUgaW1wb3J0ZWQsIHY5IG5lZWRzIHRvIGJlIGluIHRoZSBnbyBtb2R1bGU=-->chore: to allow the runner to be imported, v9 needs to be in the go module<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/777
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-31 10:35:11 +00:00
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
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
4b5c96dc22 fix: return an error when the argument count is wrong
Closes forgejo/runner#307
2024-10-31 16:02:17 +01:00
TheFox0x7
2ca53dd660 [FORGEJO] add forge alias for github (#37)
I left gitea for backwards compatibility

Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/37
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: TheFox0x7 <thefox0x7@gmail.com>
Co-committed-by: TheFox0x7 <thefox0x7@gmail.com>
2024-04-02 18:23:26 +00:00
Chongyi Zheng
a7c4e92822 Merge branch 'nektos/master' into bump-nektos 2024-02-17 13:19:51 -05:00
Jon Jensen
82d61eaf05 Fix float formatting (#2018)
Format floats the same way as actions/runner (precision 15, remove
trailing zeroes)

See: 67d70803a9/src/Sdk/DTObjectTemplating/ObjectTemplating/Tokens/NumberToken.cs (L34)
2023-10-13 20:01:04 +00:00
techknowlogick
b2f90e32b0 Merge remote-tracking branch 'upstream/master' into bump-nektos 2023-10-11 15:28:38 -04:00
ChristopherHX
c76b40fc00 fix: use actions/runner hashfiles in container (#1940)
* fix: use actions/runner hashfiles in container

Previously hashfiles ran on the host,
this don't work for container generated content

* fix: lint

* fix: lint

* fix assign follow symlink flag

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

---------

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-10-03 22:56:18 +00:00
techknowlogick
756db53bab Merge nektos/act/v0.2.51 2023-09-24 15:09:26 -04:00
ChristopherHX
8bd6d17778 Shorten or/and in expressions (#1939)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-08-08 14:30:13 +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
Casey Lee
28c6da4522 chore: upgrade golangci-lint and address findings (#1904) 2023-07-10 17:12:12 -07:00
sillyguodong
c0aa38abea Follow upstream support for variables (#66)
Because the upstream [PR](https://github.com/nektos/act/pull/1833) already supports variables, so this PR revert #43 (commit bc78c7964a), and cherry-pick commit [6ce45e3](6ce45e3f24).

Co-authored-by: Kuan Yong <wong0514@gmail.com>
Reviewed-on: https://gitea.com/gitea/act/pulls/66
Reviewed-by: Jason Song <i@wolfogre.com>
Co-authored-by: sillyguodong <gedong_1994@163.com>
Co-committed-by: sillyguodong <gedong_1994@163.com>
2023-06-12 06:54:17 +00:00
Kuan Yong
376c3ab8f3 feature: Add support for github action variables (#1833)
* feature: Add support for github action variables

* add --var flag for github variables

* unitests: Updated unittests to cover vars context.

* Remove syntax extension for vars and correct unit tests

* Update pkg/runner/expression.go

Co-authored-by: ChristopherHX <christopher.homberger@web.de>

---------

Co-authored-by: kuanyong-wong-partior <kuanyong.wong@partior.com>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
2023-06-10 18:09:27 +00:00
sillyguodong
bc78c7964a Support configuration variables (#43)
related to: https://gitea.com/gitea/act_runner/issues/127

This PR make `act` support the expression like `${{ vars.YOUR_CUSTOM_VARIABLES }}`.

Reviewed-on: https://gitea.com/gitea/act/pulls/43
Reviewed-by: Jason Song <i@wolfogre.com>
Co-authored-by: sillyguodong <gedong_1994@163.com>
Co-committed-by: sillyguodong <gedong_1994@163.com>
2023-04-19 15:22:56 +08:00
Jason Song
f823f12503 Support gitea context (#27)
And we will be able to use context like `${{ gitea.repository }}` in workflows yaml files, it's same as `${{ github.repository }}`

Reviewed-on: https://gitea.com/gitea/act/pulls/27
Reviewed-by: Zettat123 <zettat123@noreply.gitea.io>
2023-03-23 12:14:28 +08:00
Jason Song
e29fd4cac7 fix: return err in walk (#1667)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-03-08 15:13:11 +00:00
Alex Savchuk
1f1adbac3d fix: compare properties of Invalid types (#1645)
* fix: compare properties of Invalid types

 fix: compare properties of Invalid types #1643

* fix linter problem

* Fix review comment
2023-03-03 08:16:33 +00: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
Aaron Holmes
5f0cee8ce1 feat: Support "result" on "needs" context. (#1497)
* Support "result" on "needs" context.

This change adds "result" to a job's "needs" context, as documented [here](https://docs.github.com/en/actions/learn-github-actions/contexts#needs-context). `act` currently tracks the success/failure/cancelled status of a job, but does not include this value the `needs` context.

Fixes #1367

* Change `Needs` to use a new struct rather than the open type `interface{}`.

Related #1497
Fixes #1367

* Add integration test to "needs" context change.

Relates: #1497

* feat: allow to spawn and run a local reusable workflow (#1423)

* feat: allow to spawn and run a local reusable workflow

This change contains the ability to parse/plan/run a local
reusable workflow.
There are still numerous things missing:

- inputs
- secrets
- outputs

* feat: add workflow_call inputs

* test: improve inputs test

* feat: add input defaults

* feat: allow expressions in inputs

* feat: use context specific expression evaluator

* refactor: prepare for better re-usability

* feat: add secrets for reusable workflows

* test: use secrets during test run

* feat: handle reusable workflow outputs

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* 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>

* fix: tail (not absolute) as entrypoint of job container (#1506)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Fix conflict in merge.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-12-19 08:37:53 +00:00
Randolph Chung
76d766bcd1 fix: handle subdirectors and exclusions (#1012) (#1446) 2022-11-21 14:47:38 +00:00
Alex Savchuk
658b6fdbf8 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
Markus Wolf
f84de6fb2b implement pre and post steps (#1089)
* feat: add post step to actions and add state command

This commit includes requried changes for running post steps
for local and remote actions.
This allows general cleanup work to be done after executing
an action.

Communication is allowed between this steps, by using the
action state.

* feat: collect pre and post steps for composite actions

* refactor: move composite action logic into own file

* refactor: restructure composite handling

* feat: run composite post steps during post step lifecycle

* refactor: remove duplicate log output

* feat: run all composite post actions in a step

Since composite actions could have multiple pre/post steps inside,
we need to run all of them in a single top-level pre/post step.

This PR includes a test case for this and the correct order of steps
to be executed.

* refactor: remove unused lines of code

* refactor: simplify test expression

* fix: use composite job logger

* fix: make step output more readable

* fix: enforce running all post executor

To make sure every post executor/step is executed, it is chained
with it's own Finally executor.

* fix: do not run post step if no step result is available

Having no step result means we do not run any step (neither pre
nor main) and we do not need to run post.

* fix: setup defaults

If no pre-if or post-if is given, it should default to 'always()'.
This could be set even if there is no pre or post step.
In fact this is required for composite actions and included post
steps to run.

* fix: output step related if expression

* test: update expectation

* feat: run pre step from actions (#1110)

This PR implements running pre steps for remote actions.
This includes remote actions using inside local composite actions.

* fix: set correct expr default status checks

For post-if conditions the default status check should be
always(), while for all other if expression the default status
check is success()

References:
https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions
https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runspost-if

* fix: remove code added during rebase
2022-05-24 13:36:06 +00:00
ChristopherHX
547b9fd922 fix: conclusion and outcome are no integers (#1136)
* fix: conclusion and outcome are no integers

* Change Test

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-04-26 20:24:13 +00:00