Public composite action: should we call actions/checkout and actions/setup-java?
#73309
Select Topic AreaQuestion BodyWe developed some public GitHub Actions that allow users to scan their source code. Some of the steps in our composite actions require Java to be available (even if the source code to be scanned is not Java), and obviously we require the source code to be checked out. Does it make sense to call What if the calling workflow does include the
|
Replies: 4 comments 3 replies
|
You should design your action to work with a broader range of Java versions, thereby reducing the potential for conflicts. |
|
Related issue: actions/setup-java#552 which might solve the As a workaround, I guess we could hack...save all the env | grep '^JAVA_HOME_|^PATH' > "${{ runner.temp }}/pre-vars"and then as a cat ${{ runner.temp }}/pre-vars" >> "${GITHUB_ENV}"(totally untested, scripts only for comms.) Re checkout: I would leave that to the user, because you can't know how to clone their repo (submodules, sparse, history, token!, etc.). Considering the age of this, what did you end up doing? |
|
Another - name: "Execute my Java-requiring thing"
env:
PATH: "${{ env.JAVA_HOME_17_X64 }}/bin:${{ env.PATH }}"
shell: bash
run: java -jar foo.jarSadly, this does not work however awesome it looks at first sight. In composite actions However, this works: - name: "Execute my Java-requiring thing"
shell: bash
run: |
PATH="${JAVA_HOME_17_X64}/bin:${PATH}"
java -jar foo.jarNote: the author of the composite action is responsible for correct architecture selection! |
|
@TWiStErRob Maybe it could be of help looking up to the way I did use it at https://github.com/mavenplugins/reusable-gh-actions/blob/master/.github/workflows/__maven_clean_deploy.yml This is:
This was the driver to file PR setup-java#553 Feel free to fork or make use of |
Related issue: actions/setup-java#552 which might solve the
actions/setup-javapart.As a workaround, I guess we could hack...
save all the
JAVA_HOME*andPATHvariables to a temp file, something like:and then as a
post:/last step (if: success() || failure()): do a(totally untested, scripts only for comms.)
Re checkout: I would leave that to the user, because you can't know how to clone their repo (submodules, sparse, history, token!, etc.).
Considering the age of this, what did you end up doing?