Skip to content

Check files not working if jobs is using a matrix to generate different values #2746

@navneet1v

Description

@navneet1v

Description

I am trying to integrate the check files steps and based on the output I am trying to see if I can avoid running some mandatory steps.

Here is a sample

jobs:
  check-files:
    runs-on: ubuntu-latest
    outputs:
      RUN_GRADLE_CHECK: ${{ steps.changed-files-specific.outputs.any_changed }}
    steps:
      - uses: actions/checkout@v6
      - name: Get changed files
        id: changed-files-specific
        uses: tj-actions/[email protected]
        with:
          files: |
            src/**
            
      
      - name: Debug file changes
        run: |
          echo "Any changed: ${{ steps.changed-files-specific.outputs.any_changed }}"
          echo "Changed files: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
          echo "Event name: ${{ github.event_name }}"
          echo "Java version: ${{ matrix.java }}"

  Remote-Index-Build-IT-Tests:
    needs: check-files
    strategy:
      matrix:
        java: [21]
    if: needs.check-files.outputs.RUN_GRADLE_CHECK == 'true'

    name: Remote-Index-Build-IT-Tests on Linux
    runs-on:
      group: selfhosted-gpu-runners
      labels: g6xlarge

    steps:
      - name: Checkout myPackage
        uses: actions/checkout@v4

Now if I don't add the check files the final github action that gets created in Remote-Index-Build-IT-Tests on Linux (21), but I don't want Remote-Index-Build-IT-Tests on Linux (21) to run. But even with the above code it is running it all the time and skip Remote-Index-Build-IT-Tests on Linux which is not even a step. I think the issue is once the matrix expands the name of the step is changed which is causing this issue.

Any suggestion/solution how I can fix this?

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