Skip to content

How to use with multiple workflow files? #34

@dkaszews

Description

@dkaszews

I have my jobs split across multiple workflow files for organization:

  1. actionlint.yaml with job actionlint
  2. format.yaml with jobs flake8 and mypy
  3. test.yaml with jobs unit-test and integration-test

I have created a third file required.yaml with following:

name: Required
on:
  workflow_dispatch:
  push:
    branches:
      - main
  pull_request:

jobs:
  required:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    if: always()
    needs:
      - actionlint
      - flake8
      - mypy
      - unit-test
      - integration-test
    steps:
      - uses: actions/checkout@v4
      - uses: re-actors/alls-green@release/v1
        with:
          jobs: ${{ toJSON(needs) }}

But the Required check gets skipped, while Actionlint fails with:

Error: .github/workflows/required.yaml:10:3: job "required" needs job "actionlint" which does not exist in this workflow [job-needs]

I understand this means the needs only works in the same workflow file, so how do I check others? Do I need to duplicate the required job in every file?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions