Skip to content
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 if condition for upload-logs step #87

Merged

Conversation

lihop
Copy link
Contributor

@lihop lihop commented Jan 14, 2023

Previously the if condition was always evaluating to a truthy string (e.g. 'false == "true"' or 'true == "true"') as the string comparison (== 'true') was not inside the expression syntax (${{ }}) and thus being treated as a string rather than being evaluated.

@lihop
Copy link
Contributor Author

lihop commented Jan 14, 2023

Here is a workflow I created to test this PR: https://github.com/lihop/cache-apt-pkgs-action/blob/test/.github/workflows/test.yml.

In this run before the patch, it uploads logs for both steps despite only one having debugging enabled.
In this run after the patch, it only uploads logs for the step with debugging enabled.

Previously the if condition was always evaluating to a truthy string
(e.g. 'false == "true"' or 'true == "true"') as the string comparison
(`== 'true'`) was not inside the expression syntax (`${{ }}`) and thus
being treated as a string rather than being evaluated.
@lihop lihop force-pushed the bugfix/#86/upload-logs-if-condition branch from 681aa77 to 0ef6349 Compare January 15, 2023 05:27
Copy link

@ButterscotchV ButterscotchV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving because this matches the format used throughout GitHub docs:

if: ${{ vars.USE_VARIABLES == 'true' }}
https://docs.github.com/en/actions/learn-github-actions/variables

@awalsh128
Copy link
Owner

Thanks for the PR! I usually pull these into staging first but this is really straight forward. Going to roll this into a few more outstanding things before a new release. Let me know if you need it sooner.

@awalsh128 awalsh128 merged commit 9b2b4f2 into awalsh128:master Jan 17, 2023
awalsh128 added a commit that referenced this pull request Feb 4, 2023
* Fix if condition for upload-logs step (#87)

Previously the if condition was always evaluating to a truthy string
(e.g. 'false == "true"' or 'true == "true"') as the string comparison
(`== 'true'`) was not inside the expression syntax (`${{ }}`) and thus
being treated as a string rather than being evaluated.

* Introduce a force update value for reloading cache #82

---------

Co-authored-by: Leroy Hopson <github@leroy.geek.nz>
awalsh128 added a commit that referenced this pull request Feb 4, 2023
* Address block style package issue #84 #88

* Use cache key for upload artifact name #89.

* Sync master back to dev. (#92)

* Fix if condition for upload-logs step (#87)

Previously the if condition was always evaluating to a truthy string
(e.g. 'false == "true"' or 'true == "true"') as the string comparison
(`== 'true'`) was not inside the expression syntax (`${{ }}`) and thus
being treated as a string rather than being evaluated.

* Introduce a force update value for reloading cache #82

---------

Co-authored-by: Leroy Hopson <github@leroy.geek.nz>

---------

Co-authored-by: Leroy Hopson <github@leroy.geek.nz>
@lihop lihop deleted the bugfix/#86/upload-logs-if-condition branch February 9, 2023 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants