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
Determine labels for checks using labels.yml, factor out common workflow utils #2046
Conversation
|
||
def write_to_github_output(lines: list[str]) -> None: | ||
""" | ||
Write a list of strings to both stdout and the GITHUB_OUTPUT environment variable. |
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 we need both? What is stdout
output used for?
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 like writing to stdout
so that it's printed in the workflow logs and helps with debugging.
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.
LGTM, this is great. Now only if there was a way to merge .github/filters.yml
into the labels file as well.
On the other hand, I see less and less utility everyday in even having a labels.yml
file, considering we only have two repos now (and @sarayourfriend is already coming up with interesting ways of integrating the infra into the monorepo as well).
@@ -80,6 +80,7 @@ jobs: | |||
id: set-matrix | |||
env: | |||
CHANGES: ${{ needs.get-changes.outputs.changes }} | |||
PYTHONPATH: ${{ github.workspace }}/automations/python |
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 curious, why this is necessary? Is it because of the shared functions being imported into other Python files? If so, is it better to make it a a standard Python module using an __init__.py
file instead of editing PYTHONPATH
?
|
||
def write_to_github_output(lines: list[str]) -> None: | ||
""" | ||
Write a list of strings to both stdout and the GITHUB_OUTPUT environment variable. |
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 like writing to stdout
so that it's printed in the workflow logs and helps with debugging.
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.
🆒 LGTM!
Fixes
Fixes #1195 by @AetherUnbound
Description
This PR is primarily intended to modify the
pr_label_check.yml
GitHub Action workflow so that it reads from thelabels.yml
definition rather then requiring the label groups be explicitly redefined. In order to do this, I factored out some shared functions which read in the labels and convert them to Python objects. I also factored out code in several of our workflow python scripts which would print data to bothstdout
and theGITHUB_OUTPUTS
destinations. I had to add thePYTHONPATH
environment variable to the places where we call python scripts in order to have those shared modules load properly.The effect of this is now any labels we add to the required categories in
labels.yml
will automatically be added to thepr_label_check
workflow!Testing Instructions
The fact that CI passes here is sign that things are working! See the output from the adjusted actions to see that they are still outputting what they were before.
Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin