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

Error when trying to use the action in multiple steps #134

Closed
SMoraisAnsys opened this issue Jan 23, 2024 · 4 comments · Fixed by #135
Closed

Error when trying to use the action in multiple steps #134

SMoraisAnsys opened this issue Jan 23, 2024 · 4 comments · Fixed by #135

Comments

@SMoraisAnsys
Copy link
Contributor

I'm currently using this wonderful action and I'm encountering a minor bug.

To design an action for a group of projects, I wanted to use hadolint-gh-action in two different steps where the first works on directory docker and the second on .devcontainer. However, if one wants to use the action twice, there is an issue because of mkdir ${{ github.action_path }}/bin in the action.yml file. Since it already exists, you end up with the following error mkdir: cannot create directory ‘/home/runner/work/_actions/jbergstroem/hadolint-gh-action/v1/bin’: File exists.

A quick fix would be to use option -p of mkdir to avoid throwing an error is the path exists.

SMoraisAnsys added a commit to SMoraisAnsys/hadolint-gh-action that referenced this issue Jan 23, 2024
Problem
When one wants to use hadolint-gh-action multiple times, an error is raised because the bin directory already exists, see jbergstroem#134

Solution
Use option -p of mkdir
@jbergstroem
Copy link
Owner

Interesting find! I guess we could just exit early if the binary already exists. I can make that change unless you're keen!

@SMoraisDev
Copy link

Interesting find! I guess we could just exit early if the binary already exists. I can make that change unless you're keen!

Thanks for this fast answer ! Isn't #135 enough to fix this issue ?
If there is a need for something else, please let me know !

@jbergstroem
Copy link
Owner

Interesting find! I guess we could just exit early if the binary already exists. I can make that change unless you're keen!

Thanks for this fast answer ! Isn't #135 enough to fix this issue ? If there is a need for something else, please let me know !

It would definitely fix the issue; just thinking skipping a download shave off some seconds. To be correct it'd have to take version change checks into consideration though.

@SMoraisAnsys
Copy link
Contributor Author

SMoraisAnsys commented Jan 24, 2024

Interesting find! I guess we could just exit early if the binary already exists. I can make that change unless you're keen!

Thanks for this fast answer ! Isn't #135 enough to fix this issue ? If there is a need for something else, please let me know !

It would definitely fix the issue; just thinking skipping a download shave off some seconds. To be correct it'd have to take version change checks into consideration though.

You're right, I'll update the PR to skip it if needed. Thanks for pointing that out !

jbergstroem added a commit to SMoraisAnsys/hadolint-gh-action that referenced this issue Feb 2, 2024
When running the action twice in a job, it fails because
the directory we tried to create already exists.

Check if there already is a binary and that it is the version
we expect. This also saves us a bit of time by avoiding a re-download.

Finally, add e2e tests to cover all use-cases.

PR: jbergstroem#135
Closes: jbergstroem#134
Co-Authored-By: Johan Bergström <[email protected]>
jbergstroem added a commit to SMoraisAnsys/hadolint-gh-action that referenced this issue Feb 2, 2024
When running the action twice in a job, it fails because
the directory we tried to create already exists.

Check if there already is a binary and that it is the version
we expect. This also saves us a bit of time by avoiding a re-download.

Finally, add e2e tests to cover all use-cases.

PR: jbergstroem#135
Closes: jbergstroem#134
Co-Authored-By: Johan Bergström <[email protected]>
jbergstroem added a commit that referenced this issue Feb 2, 2024
When running the action twice in a job, it fails because
the directory we tried to create already exists.

Check if there already is a binary and that it is the version
we expect. This also saves us a bit of time by avoiding a re-download.

Finally, add e2e tests to cover all use-cases.

PR: #135
Closes: #134
Co-Authored-By: Johan Bergström <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants