CI/CD: Set git SHA explicitely in nerves-preview + Add optional version name input #642
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The current version of the
nerves-preview
workflow has a major flaw (noted by @gBillal ): It always builds and publishes themaster
branch of ExNVR, which defeats the purpose of the workflow.After investigation, the root cause is the Github workflow trigger:
issue_comment
always runs on the main branch of the repo (as a security measure). 1Changes
This PR fixes the issue by making the workflow:
1- Set an additional output
git_sha
during thenerves-preview.prepare
phase, which was previously fetched from the Github API.2- Pass
git_sha
to thenerves
reusable workflow as an input (defaults tomaster
)3- Use it in the
actions/checkout
stepOther changes
Add an optional version input in the command, to manually specify a version.
e.g.:
/build version=<custom version name>
Important note
Testing the workflow in this PR won't work, because of the same Github security restriction mentioned above.
It has to be merged into
master
first. 1For validation, I have the same version of the workflow available on this fork https://github.com/halimb/ex_nvr
Footnotes
See: Issue_comment restricted to master: https://github.com/orgs/community/discussions/59389
See: New workflows must be merged: https://github.com/orgs/community/discussions/25746 ↩ ↩2