question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

core.error() does not fail the workflow

See original GitHub issue

According to https://github.com/actions/toolkit/tree/main/packages/core#annotations this code should fail the build: core.error('Fatal error'). It does not. The workflow succeeds.

jobs:
  fail:
    runs-on: ubuntu-latest
    steps:
      - name: Fail workflow
        uses: actions/github-script@v6.0.0
        with:
          script: core.error('Fatal error')

I can see the annotation on the actions page but not on the pull request page. Also I get a green checkmark indicating that the workflow was successfull.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
T3rm1commented, Jun 10, 2022

Yes, it does.

1reaction
joshmgrosscommented, Jun 10, 2022

@T3rm1 does this work if you use core.setFailed instead?

/**
 * Sets the action status to failed.
 * When the action exits it will be with an exit code of 1
 * @param message add error issue message
 */
export function setFailed(message: string | Error): void {
  process.exitCode = ExitCode.Failure

  error(message)
}

https://github.com/actions/toolkit/blob/b5f31bb5a25d129441c294fc81ba7f92f3e978ba/packages/core/src/core.ts#L208-L217

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fail a job in Github Actions? - Stack Overflow
As part of the workflow, I have to check whether 2 environment variables are equal. If they don't - fail the job. As...
Read more >
Fix error "[CORE_0003] An internal exception occurred with ...
[CORE_0003] An internal exception occurred with message: [LGS_10052] The Log Service has no record of the requested session or workflow run.
Read more >
Troubleshoot and diagnose workflow failures - Azure Logic Apps
If the trigger doesn't fire, try the following steps. ... Review the inputs, outputs, and any error messages for the failed step.
Read more >
Job and Tool Error Help - Galaxy Community Hub
The cluster error help is server specific for Galaxy Main at ... Did the job fail with some comments that are not descriptive...
Read more >
Dealing with Failures - Metaflow Docs
Failures are a natural, expected part of data science workflows. Here are some typical reasons why you can expect your workflow to fail:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found