Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not assume working_directory is github.workspace #4103

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

ajfabbri
Copy link
Contributor

@ajfabbri ajfabbri commented Apr 9, 2024

Setting working_directory for ansible-lint action would fail due to hard-coded .git, introduced in commit 6f728e0, when fetching .config/requirements-lock.txt.

This fix replaces .git with ${{ github.workspace }}/.git to make working_directory argument work again.

Tested that this does fix my github action, i.e.:

name: ansible-lint
on:
  pull_request:
    branches: ["main", "release/v*"]
jobs:
  build:
    name: Ansible Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Run ansible-lint
        uses: ajfabbri/ansible-lint@main
        # this is broken :-( https://github.com/ansible/ansible-lint/issues/3938
        with:
          working_directory: iac

Fixes #3938

Setting `working_directory` for ansible-lint action would fail due to
hard-coded `.git`, introduced in commit 6f728e0, when fetching
`.config/requirements-lock.txt`.

This fix replaces `.git` with `${{ github.workspace }}/.git` to make
`working_directory` argument work again.
@ajfabbri ajfabbri marked this pull request as ready for review April 9, 2024 19:37
@ajfabbri ajfabbri requested a review from a team as a code owner April 9, 2024 19:37
@ajfabbri ajfabbri requested review from ssbarnea and Qalthos and removed request for a team April 9, 2024 19:37
@audgirka audgirka added the bug label Apr 10, 2024
@Qalthos Qalthos self-assigned this Apr 24, 2024
@Qalthos Qalthos merged commit 9a8db9f into ansible:main Apr 25, 2024
22 of 24 checks passed
@ssbarnea ssbarnea changed the title Fix #3938: don't assume working_directory is github.workspace Do not assume working_directory is github.workspace Apr 30, 2024
@commarla
Copy link

Thanks for this PR. I was waiting for this but then I encountered this bug actions/runner#2058
This solution does not working if running the action inside a container

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

github action fails to download ansible-lint-requirements.txt, assumes .git dir exists in working directory
4 participants