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

[NoQA] Updating the isExpensifyEmployee action #8010

Merged
merged 9 commits into from
Mar 8, 2022

Conversation

mountiny
Copy link
Contributor

@mountiny mountiny commented Mar 4, 2022

Details

We are trying to update the new contributor comment to only show when the contributor is the author of the PR. Currently, we show the comment for Expensify employees' first PR.

Although the job code is basically the same as here:

validateActor:
runs-on: ubuntu-latest
outputs:
IS_DEPLOYER: ${{ fromJSON(steps.isUserDeployer.outputs.isTeamMember) || github.actor == 'OSBotify' }}
steps:
- id: isUserDeployer
uses: tspascoal/get-user-teams-membership@baf2e6adf4c3b897bd65a7e3184305c165aec872
with:
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
username: ${{ github.actor }}
team: mobile-deployers
createNewVersion:
needs: validateActor
runs-on: ubuntu-latest
if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) && github.event.inputs.NEW_VERSION == '' }}
outputs:
NEW_VERSION: ${{ steps.getNewVersion.outputs.NEW_VERSION }}
steps:

It seems it does not work as expected. The steps of the newContributorWelcomeMessage job are being run even for internal contributors, which should not happen.

I am just trying out in this PR, whether the same name of the output variable as the job is not causing this issue, currently, I do not know why it does not work.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/194440

Tests

  • Verify that no errors appear in the JS console

PR Review Checklist

Contributor (PR Author) Checklist

  • I verified the PR has a small number of commits behind main
  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I clearly indicated the environment tests should be run in (Staging vs Production)
  • I wrote testing steps that cover success & fail scenarios (if applicable)
  • I included screenshots or videos for tests on all platforms
  • I ran the tests & veryfy they passed on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • I verified there are no console errors related to changes in this PR
  • I followed proper code patterns (see Reviewing the code)
    • I added comments when the code was not self explanatory
    • I put all copy / text shown in the product in all src/languages/* files (if applicable)
    • I followed proper naming convention for platform-specific files (if applicable)
    • I followed style guidelines (in Styling.md) for all style edits I made
    • I followed the JSDocs style guidelines (in STYLE.md)
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I corroborated the UI performance was not affected (the performance is the same than main branch)
  • If I created a new component I verified that a similar component doesn't exist in the codebase

PR Reviewer Checklist

  • I verified the PR has a small number of commits behind main
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the testing environment is mentioned in the test steps
  • I verified testing steps cover success & fail scenarios (if applicable)
  • I checked that screenshots or videos are included for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • I verified there are no console errors related to changes in this PR
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified comments were added when the code was not self explanatory
    • I verified any copy / text shown in the product was added in all src/languages/* files (if applicable)
    • I verified proper naming convention for platform-specific files was followed (if applicable)
    • I verified style guidelines were followed
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components are not impacted by changes in this PR (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified the UI performance was not affected (the performance is the same than main branch)
  • If a new component is created I verified that a similar component doesn't exist in the codebase

QA Steps

  • Verify that no errors appear in the JS console

I will take care of the QA. Same as here #7672

@mountiny mountiny requested a review from a team as a code owner March 4, 2022 15:57
@mountiny mountiny self-assigned this Mar 4, 2022
@MelvinBot MelvinBot requested review from chiragsalian and removed request for a team March 4, 2022 15:58
@mountiny
Copy link
Contributor Author

mountiny commented Mar 4, 2022

Also, I have asked in Slack about another possible problem, which could be that the OS_BOTIFY does not have read access to the expensify-expensify team members and that is why it cant confirm.

@mountiny
Copy link
Contributor Author

mountiny commented Mar 4, 2022

Updated to check for engineering team, per Slack thread here.

@mountiny mountiny requested a review from AndrewGable March 4, 2022 18:04
@mountiny
Copy link
Contributor Author

mountiny commented Mar 4, 2022

Kindly asking you @AndrewGable for review as we discussed it in Slack, but no urgency here.

chiragsalian
chiragsalian previously approved these changes Mar 7, 2022
Copy link
Contributor

@chiragsalian chiragsalian left a comment

Choose a reason for hiding this comment

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

LGTM, the only thing that you've to change is what andrew requested.

@mountiny
Copy link
Contributor Author

mountiny commented Mar 7, 2022

Yes, sorry for the delay, hindered with school today! Gonna have a look soon.

Co-authored-by: Andrew Gable <andrew@expensify.com>
@mountiny
Copy link
Contributor Author

mountiny commented Mar 7, 2022

@chiragsalian @AndrewGable I have accepted the suggestion for expensify team, however, I am not completely sure it would work. Looking for team with such a name returns 404 https://github.com/orgs/Expensify/teams/expensify

@AndrewGable
Copy link
Contributor

Yeah it didn't work 🤷

Screen Shot 2022-03-07 at 3 32 43 PM

@AndrewGable
Copy link
Contributor

Can we add more logs somehow? Or look in the action's repo for some help in investigation?

@mountiny
Copy link
Contributor Author

mountiny commented Mar 8, 2022

It worked for the engineering team 🤔
image

@mountiny
Copy link
Contributor Author

mountiny commented Mar 8, 2022

Ok, found the problem it is looking for Expensify/expensify team...
image

@mountiny
Copy link
Contributor Author

mountiny commented Mar 8, 2022

Confirmed the Expensify/expensify team forws well so I will update the code and clean up!

image

@mountiny
Copy link
Contributor Author

mountiny commented Mar 8, 2022

@chiragsalian @AndrewGable Alright, this should finally work. Thank you for your review!

Also thanks to @AndrewGable for proposing to use the lint for debugging, I did not know about this! Great to know :)


newContributorWelcomeMessage:
runs-on: ubuntu-latest
needs: isExpensifyEmployee
if: ${{ github.actor != 'OSBotify' && !fromJSON(needs.isExpensifyEmployee.outputs.isExpensifyEmployee) }}
if: ${{ github.actor != 'OSBotify' && !fromJSON(needs.isExpensifyEmployee.outputs.IS_EXPENSIFY_EMPLOYEE) }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be an OR instead of an AND?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OR would let OSBotify through no? OSBotify is not a member of the team so if it will be OR the other condition will always be true.

@chiragsalian chiragsalian merged commit 47b4541 into main Mar 8, 2022
@chiragsalian chiragsalian deleted the vit-updateIsExpensifyEmployee branch March 8, 2022 18:51
@OSBotify
Copy link
Contributor

OSBotify commented Mar 8, 2022

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@mountiny
Copy link
Contributor Author

mountiny commented Mar 9, 2022

Thanks for your help and patience on this one 😅

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @chiragsalian in version: 1.1.42-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@roryabraham
Copy link
Contributor

roryabraham commented Mar 11, 2022

Was anything done to verify if this worked? The team is called expensify-expensify and it's in the Expensify org:

image

Also, I had a contributor's first PR merged here yesterday and there was no welcome comment. See the job was skipped: https://github.com/Expensify/App/runs/5490903931?check_suite_focus=true

@mountiny
Copy link
Contributor Author

@roryabraham yes, we run this in lint workflow to see what the output is and you can see it here where it works. I have printed out the contents of the teams which showed the team is called Expensify/expensify team (I dont know why) and then it worked well - returned true for me.

But I see what is worng there:
image

It seems the {{ github. actor }} is the one who merges it not the author of the PR as it treats the merge event.

@mountiny
Copy link
Contributor Author

So I will need to use this step: steps.getMergedPullRequest.outputs.author to get the author.

@roryabraham
Copy link
Contributor

roryabraham commented Mar 11, 2022

Oh, nice catch. Send a PR and I will review 🙂

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @chiragsalian in version: 1.1.42-6 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

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.

5 participants