-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: add workflow templates #1
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: gatici <[email protected]>
This is still in-progress. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I have some comments
Signed-off-by: gatici <[email protected]>
Signed-off-by: gatici <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, it looks good to me.
Just in case do you have an example of how you are planning to use these GHAs in the different repositories? I am asking this because I was expecting to see something like this
branch-name:
- description: Name of the branch to checkout
- required: false
- type: string
- default: ${{ github.ref }}
+ - ${{ input_branch }}
Also, my understanding was that the workflow call is done from the perspective of the "calling" repository (e.g., amf, smf, config5g, etc.). That is, do we need to pass the branch name that we need to take action on?
Signed-off-by: gatici <[email protected]>
Signed-off-by: gatici <[email protected]>
Signed-off-by: gatici <[email protected]>
Signed-off-by: gatici <[email protected]>
Signed-off-by: gatici <[email protected]>
Signed-off-by: gatici <[email protected]>
Hello Gabriel, I used the shared workflows in this PR omec-project/amf#374 and they run successfully. Please have a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, it looks very good. I added some comments for your review. Thanks!
else | ||
echo "Failed to create release ${{ inputs.VERSION }} ❌" >> "$GITHUB_STEP_SUMMARY" | ||
echo "Failed to create release ${{ inputs.VERSION }} ❌" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add end of line
fi | |
fi | |
if: steps.version-change.outputs.changed == 'true' | ||
uses: ./actions/create-github-release | ||
with: | ||
VERSION: ${{ steps.version-change.outputs.version }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add end of line
VERSION: ${{ steps.version-change.outputs.version }} | |
VERSION: ${{ steps.version-change.outputs.version }} | |
token: ${{ secrets.GH_OMEC_PAT }} | ||
commit-message: Update version | ||
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | ||
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this line because it just indicates the user who approved the "previous" PR
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "GitHub Actions" | ||
git add VERSION && git commit -m "Update VERSION file to $NEW_VERSION" && git push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need these lines? The next task is taking care of that (add, commit and push)
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "GitHub Actions" | |
git add VERSION && git commit -m "Update VERSION file to $NEW_VERSION" && git push |
|
||
on: | ||
workflow_run: | ||
workflows: ["Tag GitHub"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this have to use brackets or can it be a list such as below?
workflows: ["Tag GitHub"] | |
workflows: | |
- "Tag GitHub" |
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.branch_name }} | ||
submodules: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to pull the submodules? I do not think any repo has a submodule
submodules: true |
- name: Get Dependencies | ||
run: go mod download |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this step? We did not need it before
|
||
on: | ||
workflow_run: | ||
workflows: ["Tag GitHub"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about something like this
workflows: ["Tag GitHub"] | |
workflows: | |
- "Tag GitHub" |
- uses: peterjgrainger/[email protected] | ||
with: | ||
branch: "rel-${{ github.event.workflow_run.outputs.version_branch }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just in case, have you checked what we can do regarding the creation of release branches (branch name is different than the content of the version file)? For example, in the amf
repo, branch rel-1.3
has VERSION file with content 1.4.0
- name: "API request to create release" | ||
shell: bash | ||
run: | | ||
if gh release create "${{ inputs.VERSION }}" --generate-notes; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I understand that the GitHub runners have, by default, the GitHub client (gh) installed? Additionally, I should understand that this cannot be in the same GHA (i.e., tag-github
) and that is why it is in its own directory (actions), correct?
@gatici, |
Adding each job templates that can be used in any repository by providing input variables.
E2E tests are not included in this PR and it only includes the existing workflows.