Workflow skips step

I am literally trying to debug this thing for a month now. I know it is a small and may be rookie problem but I give up. So here it goes like this, I want to check for broken links on my website and if the workflow finds any I want it to create issue. Note that I want it to create issue only if it founds broken link. If the action that is checking for broken links founds any broken links it returns failure/false. so I wrote this condition if: failure() && steps.check.outcome == 'failure'
So create issue step only executes if the link checking step fails. But skips the link checking step itself I tried to look at the logs it said something like this.
DEBU[0002] Evaluating 'Boolean(failure() && steps['check']['outcome'] == 'failure')' instead of 'Boolean(failure() && steps.check.outcome == 'failure')' DEBU[0002] expression 'failure() && steps.check.outcome == 'failure'' evaluated to 'false' DEBU[0002] Skipping step 'victoriadrake/link-snitch@master' due to 'failure() && steps.check.outcome == 'failure''
I tried to debug it by change the condition to if: failure() then also it skipped that step
code.
`name: Link Snitch

on:
schedule:
- cron: ‘0 1 1 * *’
workflow_dispatch:

env:
URL: https://open-horizon.github.io/
ISSUE_TEMPLATE: “.github/ISSUE_TEMPLATE/check-broken-links.md”

jobs:
build:

runs-on: ubuntu-latest

steps:
  - name: Check out master
    uses: actions/checkout@master
    with:
      fetch-depth: 1
  
  
  - id: check
    uses: victoriadrake/link-snitch@master
    with:
      Resursive urls: true
      URL: https://open-horizon.github.io/

    if: failure() && steps.check.outcome == 'failure'
  - uses: JasonEtco/create-an-issue@v2.4.0
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    with:
      filename: ${{ env.ISSUE_TEMPLATE }}`

The problem is that the if is part of the check step itself. The line after the if starts the next item in the YAML list steps. That never matches because at the time when the runner checks if the check step should run, it doesn’t have an outcome yet, and nothing failed unless there’s an error during checkout. :slightly_smiling_face:

If you want the condition to apply to the create-an-issue step, you need to move the condition into that step (note the location of the dash!):

  - id: check
    uses: victoriadrake/link-snitch@master
    with:
      Resursive urls: true
      URL: https://open-horizon.github.io/

  - if: failure() && steps.check.outcome == 'failure'
    uses: JasonEtco/create-an-issue@v2.4.0
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    with:
      filename: ${{ env.ISSUE_TEMPLATE }}`