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

Fix working directory when used as an github action #4213

Merged
merged 18 commits into from
Jun 21, 2024
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ runs:
GH_ACTION_REF: ${{ github.action_ref || 'main' }}
working-directory: ${{ steps.inputs.outputs.working_directory }}
run: |
wget --output-document=${{ github.workspace}}/.git/ansible-lint-requirements.txt https://raw.githubusercontent.com/ansible/ansible-lint/$GH_ACTION_REF/.config/requirements-lock.txt
wget --output-document=${{ steps.inputs.outputs.working_directory }}/.git/ansible-lint-requirements.txt https://raw.githubusercontent.com/ansible/ansible-lint/$GH_ACTION_REF/.config/requirements-lock.txt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ${{ steps.inputs.outputs.working_directory }}/ prefix is redundant, as there is already for working-directory: setting the working directory for the shell command (wget included); I just created #4232 to hopefully fix this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, this can not work. When you run this on a container it can not get correct working-directory from GITHUB environment variables. GITHUB environment variables are only available for the RUNNER, not on a container in RUNNER.

- name: Set up Python
if: inputs.setup_python == 'true'
uses: actions/setup-python@v5
with:
cache: pip
cache-dependency-path: ${{ github.workspace }}/.git/ansible-lint-requirements.txt
cache-dependency-path: ${{ steps.inputs.outputs.working_directory }}/.git/ansible-lint-requirements.txt
python-version: "3.11"

- name: Install ansible-lint
Expand Down
Loading