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 issue with "post_peek_screenshot" action failing when it's not supposed to #520

Merged
merged 5 commits into from
Feb 25, 2021

Conversation

Thomas-Boi
Copy link
Member

This PR should fix the issue mentioned in #514 .

What's new:
The "post_peek_screenshot" will now check for three different states of the trigger "peek_icons" action: "skipped", "success", and "failure. These values have to be found by console logging the github.event object. The docs don't mention this for some reason.

image

Also, GitHub Actions will construct env variables before an if check by default:
image

Before, there was an env variable that relies on a skipped step => script was failing since it couldn't construct this variable.

That's pretty much it. I've tested it using my forked branch. The behaviours are:

  • If "peek_icons" was skipped (label incorrect), the "post_peek_action" would also skip
  • If "peek_icons" was successful, the "post_peek_action" would post successful message
  • If "peek_icons" failed (either due to user or system error), the "post_peek_action" would post failure message. It'll be up to us to find what's wrong.

I thought about separating user and system error but I don't think it's worth it. It'll require some extra code and the benefit (in my opinion) is not worth it. If I was to do it, it'll be something like the check SVG workflow.

Let me know what you think

@Thomas-Boi Thomas-Boi added the devops Use this label for devops related enhancements label Feb 24, 2021
@Thomas-Boi Thomas-Boi linked an issue Feb 24, 2021 that may be closed by this pull request
@Panquesito7 Panquesito7 added the bug Use this label for pointing out bugs label Feb 24, 2021
.github/workflows/peek_icons.yml Outdated Show resolved Hide resolved
.github/workflows/peek_icons.yml Outdated Show resolved Hide resolved
run: echo $PR_NUM > pr_num.txt

- name: Upload the pr num
uses: actions/upload-artifact@v2
Copy link
Member

Choose a reason for hiding this comment

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

I think it's better to use the master version here. It's more updated than the v2 branch.

Suggested change
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@master

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it might be better to stay with v2 or at least a specific tag. That way, if the upload-artifact repo is updated and breaking change occurs, we don't have to worry about it until we upgrade the action.

Copy link
Member

Choose a reason for hiding this comment

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

@Thomas-Boi is right, (almost) always stick to a specific version and do not target a master or latest branch. Targeting a latest-release is not secure in terms of code injection attacks. You might wanna take a look at #395.

@Panquesito7
Copy link
Member

Panquesito7 commented Feb 24, 2021

Weird, not sure why here it displays two Peek Icons. 🤷‍♂️

image

At the bottom of the PR, it only displays one. 🤔

@Thomas-Boi
Copy link
Member Author

Weird, not sure why here it displays two Peek Icons. 🤷‍♂️

At the bottom of the PR, it only displays one. 🤔

Oh, I know this one. Currently, our peek action is triggered by the "bot:peek" label. To do this, we create an event whenever a label is added and check the name:

image

If the name doesn't match, it skips.

Currently, we have 2 labels. Since they aren't "bot:peek", the action will be skipped, thus the above situation.

Copy link
Member

@Panquesito7 Panquesito7 left a comment

Choose a reason for hiding this comment

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

Looks good. Thank you! 🎉 👍
Let's wait on @amacado's approval. 🙂

Copy link
Member

@amacado amacado left a comment

Choose a reason for hiding this comment

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

Good explanation @Thomas-Boi!

@amacado amacado merged commit cb34247 into develop Feb 25, 2021
@amacado amacado deleted the thomas/feature/actionBugFix branch February 25, 2021 13:34
@amacado amacado mentioned this pull request Apr 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Use this label for pointing out bugs devops Use this label for devops related enhancements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Post Check SVG" action is not working as expected
3 participants