-
Notifications
You must be signed in to change notification settings - Fork 14
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
Remove the base64 encoded scripts in the workflow files #9
Comments
Actually, the PR will test the Python script from the PR branch because However, if the reusable workflow is called by a different repository it will checkout the default branch of We could ask the user to pass the ref they used as an input to the reusable workflows although that is not ideal. Hopefully there will be a better solution soon. |
An ugly solution would be that when we are ready to tag, we add a commit that hard-codes the ref of the repo to check out, e.g. |
Another solution, not very elegant but which would at least work would be to embed the Python scripts inside the workflow YAML, for instance:
Yes this is ugly but it might be that the Python script doesn't need to be updated too often so it might not be that bad. |
See #20 for a proof of concept |
@ConorMacBride should we close this? |
This is no longer an issue so maybe just close for less noise. But we should switch to a solution that doesn't involve duplication if/when GitHub adds such a feature. |
I reopened this prompted by this comment from @lpsinger. It appears that maybe GitHub now provide the path and workflow ref inside the I am not 100% sure if this means that we can access this inside the reuseable workflow, but maybe it's enough that we can checkout the ref and we can get rid of the dirty hack of base64 encoding the scripts? |
actions/toolkit#1264 seems to suggest it's still not possible via the When I run the following in the GitHub CLI, I get gh api repos/astropy/astropy/actions/runs/12186371008 \
-q '.referenced_workflows |
map(
select(
.path |
startswith("OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@")
)
) |
.[0].sha' In a GitHub Action we should be able to do: However, if someone is calling the same reusable workflow twice in the same workflow file, we'll get multiple results and I don't think we can distinguish which is which. That would only be an issue if they are using multiple versions. The code above just takes the sha from the first match. We could detect multiple versions and just error out saying it's unsupported. |
That's annoying. I quite often change one version (or repo) in a workflow while I am testing stuff but I guess I am not a usual usecase in doing that. An alternative thought I had is if it would be possible to inline the script in plain text? |
To run the Python scripts within the reusable workflows we checkout the
main
branch of this repository. However, this means that if a PR updates a Python script the script that the PR CI tests is the version in themain
branch and no the PR branch. Need to change the following in each workflow:The text was updated successfully, but these errors were encountered: