[GH-ISSUE #1109] conditional steps incorrectly evaluates conclusion #633

Closed
opened 2026-03-01 21:45:06 +03:00 by kerem · 2 comments
Owner

Originally created by @BrianHung on GitHub (Apr 6, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1109

| {
|   "0": {
|     "outputs": {},
|     "conclusion": "success",
|     "outcome": "success"
|   },
|   "4": {
|     "outputs": {},
|     "conclusion": "success",
|     "outcome": "success"
|   },
|   "cache": {
|     "outputs": {
|       "cache-hit": "false"
|     },
|     "conclusion": "success",
|     "outcome": "success"
|   },
|   "install": {
|     "outputs": {},
|     "conclusion": "success",
|     "outcome": "success"
|   },
|   "setup": {
|     "outputs": {},
|     "conclusion": "success",
|     "outcome": "success"
|   }
| }
[build]   ✅  Success - Dump GitHub context
DEBU[0106] Loading slug from git directory '/Users/brian/web/.git' 
DEBU[0106] Loading revision from git directory '/Users/brian/web/.git' 
DEBU[0106] Found revision: c9ca2d85b3e7ee4ea4efa35cf435916bf616d042 
DEBU[0106] HEAD points to 'c9ca2d85b3e7ee4ea4efa35cf435916bf616d042' 
DEBU[0106] Found revision: c9ca2d85b3e7ee4ea4efa35cf435916bf616d042 
DEBU[0106] evaluating expression 'steps.install.conclusion == 'success'' 
DEBU[0106] expression 'steps.install.conclusion == 'success'' evaluated to 'false' 
DEBU[0106] Skipping step 'Vitest' due to 'steps.install.conclusion == 'success'' 
on:
  push:
    branches: [development, staging]
  pull_request:
    branches: [development, staging]

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [16.x]

    steps:
      - uses: actions/checkout@v2

      - name: Setup Node.js ${{ matrix.node-version }}
        id: setup
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}

      - name: Cache dependencies
        id: cache
        uses: actions/cache@v2
        with:
          path: ~/.npm
          key: node-${{ matrix.node-version }}-npm-${{ hashFiles('package-lock.json') }}
          restore-keys: npm-

      - name: Install dependencies
        id: install
        if: steps.cache.outputs.cache-hit != 'true'
        run: npm ci --ignore-scripts

      - name: Dump GitHub context
        env:
          GITHUB_CONTEXT: ${{ toJson(steps) }}
        run: echo "$GITHUB_CONTEXT"

      - name: Vitest
        id: test
        if: steps.install.outcome == 'success'
        run: npm test
        continue-on-error: true

      - name: Typescript compiler
        id: typescript
        if: steps.install.outcome == 'success'
        run: npm run tsc
        continue-on-error: true

Expected behavior is that steps.install.outcome == 'success' evaluates to true, matching the result from the context log.

Originally created by @BrianHung on GitHub (Apr 6, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1109 ``` | { | "0": { | "outputs": {}, | "conclusion": "success", | "outcome": "success" | }, | "4": { | "outputs": {}, | "conclusion": "success", | "outcome": "success" | }, | "cache": { | "outputs": { | "cache-hit": "false" | }, | "conclusion": "success", | "outcome": "success" | }, | "install": { | "outputs": {}, | "conclusion": "success", | "outcome": "success" | }, | "setup": { | "outputs": {}, | "conclusion": "success", | "outcome": "success" | } | } [build] ✅ Success - Dump GitHub context DEBU[0106] Loading slug from git directory '/Users/brian/web/.git' DEBU[0106] Loading revision from git directory '/Users/brian/web/.git' DEBU[0106] Found revision: c9ca2d85b3e7ee4ea4efa35cf435916bf616d042 DEBU[0106] HEAD points to 'c9ca2d85b3e7ee4ea4efa35cf435916bf616d042' DEBU[0106] Found revision: c9ca2d85b3e7ee4ea4efa35cf435916bf616d042 DEBU[0106] evaluating expression 'steps.install.conclusion == 'success'' DEBU[0106] expression 'steps.install.conclusion == 'success'' evaluated to 'false' DEBU[0106] Skipping step 'Vitest' due to 'steps.install.conclusion == 'success'' ``` ``` on: push: branches: [development, staging] pull_request: branches: [development, staging] jobs: build: runs-on: ubuntu-latest strategy: matrix: node-version: [16.x] steps: - uses: actions/checkout@v2 - name: Setup Node.js ${{ matrix.node-version }} id: setup uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - name: Cache dependencies id: cache uses: actions/cache@v2 with: path: ~/.npm key: node-${{ matrix.node-version }}-npm-${{ hashFiles('package-lock.json') }} restore-keys: npm- - name: Install dependencies id: install if: steps.cache.outputs.cache-hit != 'true' run: npm ci --ignore-scripts - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(steps) }} run: echo "$GITHUB_CONTEXT" - name: Vitest id: test if: steps.install.outcome == 'success' run: npm test continue-on-error: true - name: Typescript compiler id: typescript if: steps.install.outcome == 'success' run: npm run tsc continue-on-error: true ``` Expected behavior is that `steps.install.outcome == 'success'` evaluates to true, matching the result from the context log.
kerem 2026-03-01 21:45:06 +03:00
  • closed this issue
  • added the
    kind/bug
    label
Author
Owner

@ChristopherHX commented on GitHub (Apr 20, 2022):

This bug has confused me in my PR https://github.com/nektos/act/pull/1078#issuecomment-1079459355 while writing tests. The problem is that outcome is stored internally as an integer and the new expression evaluator of act v0.2.26 didn't handle this case.

github.com/nektos/act@a85e89d3fb/pkg/model/step_result.go (L19-L32)

I think the expression evaluator should either test for the TextMarshaler interface and return a string instead of an integer or refactor the code that such special things no longer needs to be handled.

<!-- gh-comment-id:1104360577 --> @ChristopherHX commented on GitHub (Apr 20, 2022): This bug has confused me in my PR https://github.com/nektos/act/pull/1078#issuecomment-1079459355 while writing tests. The problem is that `outcome` is stored internally as an integer and the new expression evaluator of act v0.2.26 didn't handle this case. https://github.com/nektos/act/blob/a85e89d3fb8e1a3b2e9dda843e18aa819095e56e/pkg/model/step_result.go#L19-L32 I think the expression evaluator should either test for the `TextMarshaler` interface and return a string instead of an integer or refactor the code that such special things no longer needs to be handled.
Author
Owner

@KnisterPeter commented on GitHub (Apr 21, 2022):

I think the expression evaluator should either test for the TextMarshaler interface and return a string instead

This would be the best I think

<!-- gh-comment-id:1104664149 --> @KnisterPeter commented on GitHub (Apr 21, 2022): > I think the expression evaluator should either test for the TextMarshaler interface and return a string instead This would be the best I think
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#633
No description provided.