-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix cleanup-dbt-resources workflow to run on data-catalog branch #58
Fix cleanup-dbt-resources workflow to run on data-catalog branch #58
Conversation
a08431e
to
fb9a6c8
Compare
echo "CI context did not match any of the expected environments" | ||
exit 1 |
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.
Not fully intentional, but the build ended up testing this path when I accidentally referenced GITHUB_REF_NAME
instead of GITHUB_HEAD_REF
for this run: https://github.com/ccao-data/data-architecture/actions/runs/5801770404/job/15726741689
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.
Nice quickfix!
# GITHUB_HEAD_REF is only set on pull_request events, so if it's | ||
# present, we must be in a PR context. Use the +x param expansion | ||
# to distinguish empty strings: https://stackoverflow.com/a/13864829 | ||
if [ ! -z ${GITHUB_HEAD_REF+x} ]; 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.
nitpick (non-blocking): Probably simpler to do: if [ -n "$GITHUB_HEAD_REF" ]; 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.
Sure thing, done in 310645e! Why does bash have so many options for such a simple operation 🙃
The
cleanup-dbt-resources
workflow is currently failing on thedata-catalog
branch becauseGITHUB_REF_NAME
appears to be set todata-catalog
even though the workflow is triggered from apull_request
event:This PR adjusts the
configure-dbt-environment
action to give higher priority to environments that haveGITHUB_HEAD_REF
set when setting theHEAD_REF
variable for a pull request, since this variable is guaranteed to only be set onpull_request
events, whereasGITHUB_REF_NAME
can be set on bothpull_request
andpush
(docs).