Skip to content

Autobuild with working-directory doesn't always work #2316

Open
@melwynpkb

Description

@melwynpkb

Hi,

I'm working in a monorepo setup and was using the following CodeQL setup to run CodeQL on a sub directory
`

- name: Initialize CodeQL
  uses: github/codeql-action/init@v3
  with:
    languages: ${{ matrix.language }}
    build-mode: ${{ matrix.build-mode }}
    config: |
      queries:
        # See https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#using-queries-in-ql-packs
        - name: Security and maintainability
          uses: security-and-quality
              
- if: matrix.language == 'csharp'
  name: Build solution
  uses: github/codeql-action/autobuild@v3
  with:
    working-directory: code/<redacted>      

- name: Perform CodeQL Analysis
  uses: github/codeql-action/analyze@v3
  with:
    category: "/language:${{matrix.language}}"`

Initially, in some runs, the autobuild step correctly picked up a .sln file from the specified working directory but since yesterday, in several runs, the option can be seen to be overriden by the autobuild script and it uses the github.workspace directory i.e., the root of the monorepo.

From the logs, I can see a difference in the environment variables and how the autobuild.sh is run

not-working.log
working.log

I'm using manual build as a workaround for now.

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