Skip to content

core.setFailed and core.error won't fail the workflow #1385

@lslzl3000

Description

@lslzl3000

I am testing a simple script with github actions

name: CI test

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Install pnpm
      uses: pnpm/action-setup@v2
      with:
        version: 7
    - name: Setup node 16
      uses: actions/setup-node@v3
      with:
        node-version: 16
        cache: pnpm
    - name: Install deps
      run: pnpm install
    - name: Test in Electron
      run: pnpm run test

and my node script is easy

const core = require('@actions/core');

ipc.on('log', (log) => {        
    if(log === 'pass'){
        console.log('CI pass')
    }else{
        core.setFailed(`CI not pass`);
    }
})
ipc.on('error', (log) => {
    core.error(log);
})

it shows errors in actions log, but the workflow still finished and marked as succeeded
Screenshot 2023-03-26 at 14 19 28

Do I miss something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions