Skip to content

Feature Request: Support job-level reusable workflows with relative paths (uses: ./.github/workflows/*.yml) #5992

@ravensorb

Description

@ravensorb

Act version

0.2.83

Feature description

Summary

act currently fails schema validation when a workflow job uses a local reusable workflow (relative path). GitHub Actions supports uses: ./.github/workflows/<workflow>.yml at the job level, but act errors before execution with "Unknown Property uses".

Expected Behavior

act should accept and execute workflows that use job-level reusable workflows with relative paths, matching GitHub Actions behavior:

jobs:
  test-in-docker:
    uses: ./.github/workflows/test-docker.yml
    secrets: inherit
    with:
      image_name: docker-apps-cfgmgr:test

Actual Behavior

act fails schema validation with the following error:

Error: workflow is not valid. 'release.yaml': Line: 65 Column 5: Failed to match job-factory: Line: 65 Column 5: Unknown Property uses
Line: 66 Column 5: Unknown Property secrets
Line: 67 Column 5: Unknown Property with
Line: 65 Column 5: Failed to match workflow-job: Line: 74 Column 22: Unknown Variable Access env
Line: 75 Column 21: Unknown Variable Access env
Line: 76 Column 25: Unknown Variable Access env
Actions YAML Schema Validation Error detected

Reproduction Steps

  1. Create a reusable workflow file: .github/workflows/test-docker.yml
name: Test in Docker (Reusable)

on:
  workflow_call:
    inputs:
      image_name:
        description: 'Docker image name for testing'
        required: false
        type: string
        default: 'docker-apps-cfgmgr:test'
      dockerfile:
        description: 'Path to Dockerfile'
        required: false
        type: string
        default: './docker/Dockerfile'
      dockerfile_target:
        description: 'Dockerfile target to build'
        required: false
        type: string
        default: 'test'
    outputs:
      coverage_file:
        description: 'Path to coverage XML file'
        value: ${{ jobs.test.outputs.coverage_file }}
      junit_file:
        description: 'Path to JUnit XML file'
        value: ${{ jobs.test.outputs.junit_file }}

jobs:
  test:
    name: test-in-docker
    runs-on: ubuntu-22.04
    outputs:
      coverage_file: ${{ steps.set-outputs.outputs.coverage_file }}
      junit_file: ${{ steps.set-outputs.outputs.junit_file }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Build and test
        run: |
          docker build --target ${{ inputs.dockerfile_target }} -f ${{ inputs.dockerfile }} -t ${{ inputs.image_name }} .
          docker run ${{ inputs.image_name }}

      - name: Set outputs
        id: set-outputs
        run: |
          echo "coverage_file=coverage.xml" >> $GITHUB_OUTPUT
          echo "junit_file=junit.xml" >> $GITHUB_OUTPUT
  1. Create a workflow that uses the reusable workflow: .github/workflows/release.yaml
name: Release Build, Test & Publish

on:
  push:
    tags:
      - '*.*.*'
  workflow_dispatch:

jobs:
  test-in-docker:
    uses: ./.github/workflows/test-docker.yml
    secrets: inherit
    with:
      image_name: docker-apps-cfgmgr:test
      dockerfile: ./docker/Dockerfile
      dockerfile_target: test

  build-and-publish:
    needs: test-in-docker
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      
      - name: Build and push
        run: echo "Building..."
  1. Run act:
act --event tag --tag v1.0.0
  1. Observe the schema validation error before any jobs execute.

Minimal Reproduction Example

File: .github/workflows/test-reusable.yml

name: Test Reusable Workflow

on:
  workflow_call:
    inputs:
      message:
        description: 'Message to print'
        required: false
        type: string
        default: 'Hello from reusable workflow'

jobs:
  test-job:
    runs-on: ubuntu-latest
    steps:
      - name: Print message
        run: echo "${{ inputs.message }}"

File: .github/workflows/main.yml

name: Main Workflow

on:
  workflow_dispatch:

jobs:
  call-reusable:
    uses: ./.github/workflows/test-reusable.yml
    with:
      message: "Hello from main workflow"

Command:

act workflow_dispatch

Expected: Workflow executes successfully
Actual: Schema validation error: Unknown Property uses

Context

This feature is important because:

  1. Reusable workflows are a core GitHub Actions feature - They allow workflows to be modular and DRY (Don't Repeat Yourself)
  2. Local testing is blocked - Developers cannot test workflows locally that use reusable workflows
  3. Even targeting a single job fails - Using act -j <job-name> still validates the entire workflow and fails
  4. Related but distinct from Issue Calling reusable workflow which uses a subworkflow at a relative path in the same repository fails with file not found. #1875 - Issue Calling reusable workflow which uses a subworkflow at a relative path in the same repository fails with file not found. #1875 is about nested reusable workflows (a reusable workflow calling another reusable workflow), while this is about job-level reusable workflows in the main workflow

Environment

  • act version: 0.2.83
  • OS: Linux (Ubuntu, kernel 6.14.0-37-generic)
  • Docker version: Docker version 29.1.4, build 0e6fee6

Additional Notes

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions