[PR #887] [MERGED] Add more steps context support #1666

Closed
opened 2026-03-01 21:52:09 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/887
Author: @victorpopkov
Created: 11/17/2021
Status: Merged
Merged: 11/27/2021
Merged by: @mergify[bot]

Base: masterHead: feature/steps-context


📝 Commits (3)

  • 2bbe4d1 feat: add more steps context support
  • 2db732a feat: add conclusion and outcome steps context tests
  • 753afdc Merge branch 'master' into feature/steps-context

📊 Changes

8 files changed (+107 additions, -15 deletions)

View changed files

📝 pkg/runner/expression.go (+11 -1)
📝 pkg/runner/expression_test.go (+12 -3)
📝 pkg/runner/run_context.go (+46 -8)
📝 pkg/runner/run_context_test.go (+6 -1)
📝 pkg/runner/runner_test.go (+2 -0)
📝 pkg/runner/step_context.go (+2 -2)
pkg/runner/testdata/steps-context/conclusion/push.yml (+14 -0)
pkg/runner/testdata/steps-context/outcome/push.yml (+14 -0)

📄 Description

Add more steps context support to match GitHub:
https://docs.github.com/en/actions/learn-github-actions/contexts#steps-context

Should reference https://github.com/nektos/act/issues/465 and https://github.com/nektos/act/pull/557.

Changes

Add step outcome

steps.<step id>.outcome string is the result of a completed step before continue-on-error.

Remove step success in favour of conclusion

steps.<step id>.conclusion string is the result of a completed step after continue-on-error is applied, which currently matches the original stepResult.Success value. So, respectively, all checks have been replaced:

  • Success == trueConclusion == stepStatusSuccess
  • Success == falseConclusion == stepStatusFailure

Tested on

  • Linux (Ubuntu 20.04.3 LTS x86_64)

All runner package tests have passed. The following workflow has been used to check the behaviour as well:

name: test
on: push

jobs:
  action-check:
    runs-on: ubuntu-latest
    steps:
      - name: First
        id: first
        run: exit 0
      - name: Second
        continue-on-error: true
        id: second
        run: exit 1
      - run: echo '${{ toJSON(steps.first) }}'
      - run: echo '${{ toJSON(steps.second) }}'
Output (before)
[test/action-check] 🚀  Start image=node:12-buster-slim
[test/action-check]   🐳  docker pull image=node:12-buster-slim platform= username= forcePull=false
[test/action-check]   🐳  docker create image=node:12-buster-slim platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[test/action-check]   🐳  docker run image=node:12-buster-slim platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[test/action-check]   🐳  docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir=
[test/action-check] ⭐  Run First
[test/action-check]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/victor/Forks/act/workflow/first] user= workdir=
[test/action-check]   ✅  Success - First
[test/action-check] ⭐  Run Second
[test/action-check]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/victor/Forks/act/workflow/second] user= workdir=
[test/action-check]   ❌  Failure - Second
[test/action-check] Failed but continue next step
[test/action-check] ⭐  Run echo '${{ toJSON(steps.first) }}'
[test/action-check]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/victor/Forks/act/workflow/2] user= workdir=
| {
|   "success": true,
|   "outputs": {}
| }
[test/action-check]   ✅  Success - echo '${{ toJSON(steps.first) }}'
[test/action-check] ⭐  Run echo '${{ toJSON(steps.second) }}'
[test/action-check]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/victor/Forks/act/workflow/3] user= workdir=
| {
|   "success": true,
|   "outputs": {}
| }
[test/action-check]   ✅  Success - echo '${{ toJSON(steps.second) }}'
INFO[0002] Cleaning up container for job action-check
Output (after)
[test/action-check] 🚀  Start image=node:12-buster-slim
[test/action-check]   🐳  docker pull image=node:12-buster-slim platform= username= forcePull=false
[test/action-check]   🐳  docker create image=node:12-buster-slim platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[test/action-check]   🐳  docker run image=node:12-buster-slim platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[test/action-check]   🐳  docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir=
[test/action-check] ⭐  Run First
[test/action-check]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/victor/Forks/act/workflow/first] user= workdir=
[test/action-check]   ✅  Success - First
[test/action-check] ⭐  Run Second
[test/action-check]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/victor/Forks/act/workflow/second] user= workdir=
[test/action-check]   ❌  Failure - Second
[test/action-check] Failed but continue next step
[test/action-check] ⭐  Run echo '${{ toJSON(steps.first) }}'
[test/action-check]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/victor/Forks/act/workflow/2] user= workdir=
| {
|   "conclusion": "success",
|   "outcome": "success",
|   "outputs": {}
| }
[test/action-check]   ✅  Success - echo '${{ toJSON(steps.first) }}'
[test/action-check] ⭐  Run echo '${{ toJSON(steps.second) }}'
[test/action-check]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/victor/Forks/act/workflow/3] user= workdir=
| {
|   "conclusion": "success",
|   "outcome": "failure",
|   "outputs": {}
| }
[test/action-check]   ✅  Success - echo '${{ toJSON(steps.second) }}'
INFO[0002] Cleaning up container for job action-check

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/nektos/act/pull/887 **Author:** [@victorpopkov](https://github.com/victorpopkov) **Created:** 11/17/2021 **Status:** ✅ Merged **Merged:** 11/27/2021 **Merged by:** [@mergify[bot]](https://github.com/apps/mergify) **Base:** `master` ← **Head:** `feature/steps-context` --- ### 📝 Commits (3) - [`2bbe4d1`](https://github.com/nektos/act/commit/2bbe4d1b96c033ec7909391273b22e7c1f151cb8) feat: add more steps context support - [`2db732a`](https://github.com/nektos/act/commit/2db732aad964fdc048c0b6df6b2715d720f45066) feat: add conclusion and outcome steps context tests - [`753afdc`](https://github.com/nektos/act/commit/753afdcbf39d3d8f3ab83afb5d6c37a9e0f5d985) Merge branch 'master' into feature/steps-context ### 📊 Changes **8 files changed** (+107 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `pkg/runner/expression.go` (+11 -1) 📝 `pkg/runner/expression_test.go` (+12 -3) 📝 `pkg/runner/run_context.go` (+46 -8) 📝 `pkg/runner/run_context_test.go` (+6 -1) 📝 `pkg/runner/runner_test.go` (+2 -0) 📝 `pkg/runner/step_context.go` (+2 -2) ➕ `pkg/runner/testdata/steps-context/conclusion/push.yml` (+14 -0) ➕ `pkg/runner/testdata/steps-context/outcome/push.yml` (+14 -0) </details> ### 📄 Description Add more steps context support to match GitHub: https://docs.github.com/en/actions/learn-github-actions/contexts#steps-context Should reference https://github.com/nektos/act/issues/465 and https://github.com/nektos/act/pull/557. ### Changes #### Add step outcome `steps.<step id>.outcome` string is the result of a completed step **before** `continue-on-error`. #### Remove step success in favour of conclusion `steps.<step id>.conclusion` string is the result of a completed step **after** `continue-on-error` is applied, which currently matches the original `stepResult.Success` value. So, respectively, all checks have been replaced: - `Success == true` &rarr; `Conclusion == stepStatusSuccess` - `Success == false` &rarr; `Conclusion == stepStatusFailure` ### Tested on - Linux (Ubuntu 20.04.3 LTS x86_64) All `runner` package tests have passed. The following workflow has been used to check the behaviour as well: ```yml name: test on: push jobs: action-check: runs-on: ubuntu-latest steps: - name: First id: first run: exit 0 - name: Second continue-on-error: true id: second run: exit 1 - run: echo '${{ toJSON(steps.first) }}' - run: echo '${{ toJSON(steps.second) }}' ``` <details> <summary><b>Output (before)</b></summary> ```txt [test/action-check] 🚀 Start image=node:12-buster-slim [test/action-check] 🐳 docker pull image=node:12-buster-slim platform= username= forcePull=false [test/action-check] 🐳 docker create image=node:12-buster-slim platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [test/action-check] 🐳 docker run image=node:12-buster-slim platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [test/action-check] 🐳 docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir= [test/action-check] ⭐ Run First [test/action-check] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/victor/Forks/act/workflow/first] user= workdir= [test/action-check] ✅ Success - First [test/action-check] ⭐ Run Second [test/action-check] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/victor/Forks/act/workflow/second] user= workdir= [test/action-check] ❌ Failure - Second [test/action-check] Failed but continue next step [test/action-check] ⭐ Run echo '${{ toJSON(steps.first) }}' [test/action-check] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/victor/Forks/act/workflow/2] user= workdir= | { | "success": true, | "outputs": {} | } [test/action-check] ✅ Success - echo '${{ toJSON(steps.first) }}' [test/action-check] ⭐ Run echo '${{ toJSON(steps.second) }}' [test/action-check] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/victor/Forks/act/workflow/3] user= workdir= | { | "success": true, | "outputs": {} | } [test/action-check] ✅ Success - echo '${{ toJSON(steps.second) }}' INFO[0002] Cleaning up container for job action-check ``` </details> <details> <summary><b>Output (after)</b></summary> ```txt [test/action-check] 🚀 Start image=node:12-buster-slim [test/action-check] 🐳 docker pull image=node:12-buster-slim platform= username= forcePull=false [test/action-check] 🐳 docker create image=node:12-buster-slim platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [test/action-check] 🐳 docker run image=node:12-buster-slim platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [test/action-check] 🐳 docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir= [test/action-check] ⭐ Run First [test/action-check] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/victor/Forks/act/workflow/first] user= workdir= [test/action-check] ✅ Success - First [test/action-check] ⭐ Run Second [test/action-check] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/victor/Forks/act/workflow/second] user= workdir= [test/action-check] ❌ Failure - Second [test/action-check] Failed but continue next step [test/action-check] ⭐ Run echo '${{ toJSON(steps.first) }}' [test/action-check] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/victor/Forks/act/workflow/2] user= workdir= | { | "conclusion": "success", | "outcome": "success", | "outputs": {} | } [test/action-check] ✅ Success - echo '${{ toJSON(steps.first) }}' [test/action-check] ⭐ Run echo '${{ toJSON(steps.second) }}' [test/action-check] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/victor/Forks/act/workflow/3] user= workdir= | { | "conclusion": "success", | "outcome": "failure", | "outputs": {} | } [test/action-check] ✅ Success - echo '${{ toJSON(steps.second) }}' INFO[0002] Cleaning up container for job action-check ``` </details> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 21:52:09 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#1666
No description provided.