skip-duplicate-actions icon indicating copy to clipboard operation
skip-duplicate-actions copied to clipboard

reusable workflow should be skipped

Open AurelienGasser opened this issue 1 year ago • 1 comments

When a workflow is reused, it is not skipped even though it ran successfully before.

Repro

  • Step 1. Run a reusable workflow with a skippable job: the skippable job is not skipped
  • Step 2. Run the reusable workflow again: the skippable job is skipped because it was already run in Step 1
  • Step 3. Run a caller workflow which calls the reusable workflow: the skippable job is not skipped
    • Expected behavior: the skippable job in the called workflow is skipped because it was already run in Step 1.
    • Actual behavior: the skippable job in the called workflow is not skipped (no_transferable_run)

Files

# test-child.yaml
name: Test (child)
on:
  workflow_dispatch:
  workflow_call:

permissions:
  actions: write
  contents: read

jobs:
  skip:
    runs-on: ubuntu-latest
    outputs:
      should_skip: ${{ steps.skip_check.outputs.should_skip }}
    steps:
      - id: skip_check
        uses: fkirc/[email protected]
        with:
          do_not_skip: '[]'

  actual-work:
    needs: skip
    if: needs.skip.outputs.should_skip != 'true'
    runs-on: ubuntu-latest
    steps:
      - name: hello
        run: echo Hello
# test-parent.yaml
name: Test (parent)
on:
  workflow_dispatch:

permissions:
  actions: write
  contents: read

jobs:
  call-child:
    uses: <owner_redacted>/<repo_redacted>/.github/workflows/test-child.yaml@<branch_redacted>

Workflow runs

Step 1.

image

Step 2.

image

Step 3.

image

AurelienGasser avatar Apr 28 '23 12:04 AurelienGasser

We've run into this too, I think it would be a very useful change.

george-palmsens avatar Jan 30 '24 15:01 george-palmsens