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

Make preDeploy workflow handle StagingDeployCash logic #1745

Merged
merged 10 commits into from
Mar 12, 2021

Conversation

roryabraham
Copy link
Contributor

@roryabraham roryabraham commented Mar 12, 2021

Details

Run two new actions at the beginning of the workflow:

  1. actions-ecosystem/get-merged-pull-request](https://github.com/actions-ecosystem/action-get-merged-pull-request)
    • It uses JS so should work on macOS runner.
    • Has only the one github_token input (note lowercase not GITHUB_TOKEN 😉), so should be pretty difficulty to misconfigure.
  2. isStagingDeployLocked

Then if the StagingDeployCash is locked, we comment on the PR stating that it will be merged later, and skip all the rest of the workflow steps. Otherwise, continue as usual, except with one new final step. In the last step, use the createOrUpdateStagingDeploy action to add the newly merged PR to the StagingDeployCash.

Fixed Issues

Fixes https://github.com/Expensify/Expensify/issues/155208

Tests

Testing plan:

  • Make sure we have a valid, open, unlocked, StagingDeployCash issue in the Expensify.cash repo.
  • Merge this PR, and we should expect:
    • OSBotify does not comment on the merged PR stating that it was not deployed yet.
    • The version is created successfully, along with a tag and an automerge PR. The automerge PR should merge and a staging deploy should commence.
    • The StagingDeployCash issue should be updated to include this PR.
  • Add the 🔐 LockCashDeploys 🔐 label to the StagingDeployCash.
  • Merge another dummy PR, and we should expect:
    • OSBotify comments on the merged PR staging that is was not deployed yet.
    • The rest of the workflow is skipped, but does not result in a failure. No new version is created, no new tag, no new automerge PR.
    • The StagingDeployCash issue should be unmodified.

@roryabraham roryabraham requested a review from AndrewGable March 12, 2021 18:13
@roryabraham roryabraham requested a review from a team as a code owner March 12, 2021 18:13
@roryabraham roryabraham self-assigned this Mar 12, 2021
@botify botify requested review from TomatoToaster and removed request for a team March 12, 2021 18:14
@roryabraham
Copy link
Contributor Author

This is off hold and ready for review, but don't merge just yet because I want to do some testing in another repo

@roryabraham
Copy link
Contributor Author

Okay, did some testing of the stuff I was unsure about here. This is updated and ready for review & merge-test.

@AndrewGable
Copy link
Contributor

Is this off hold too?

@AndrewGable AndrewGable changed the title [HOLD] Make preDeploy workflow handle StagingDeployCash logic Make preDeploy workflow handle StagingDeployCash logic Mar 12, 2021
@AndrewGable AndrewGable merged commit 2c40f2f into master Mar 12, 2021
@AndrewGable AndrewGable deleted the Rory-preDeploy branch March 12, 2021 20:36
@github-actions github-actions bot locked and limited conversation to collaborators Mar 12, 2021
@AndrewGable
Copy link
Contributor

Tests failed second step:

Unable to resolve action actions-ecosystem/get-merged-pull-request@cb1e7423b3ca9886f619a8b93874b2e72abfb87c, repository not found

https://github.com/Expensify/Expensify.cash/actions/runs/647369887

I will make a PR to resolve this and continue testing

@AndrewGable
Copy link
Contributor

PR to resolve typo 👉 #1750

I will continue testing once this is merged!

@AndrewGable
Copy link
Contributor

Got another error:

Run Expensify/Expensify.cash/.github/actions/createOrUpdateStagingDeploy@master
  with:
    GITHUB_TOKEN: ***
    NPM_VERSION: 1.0.2-44
    NEW_PULL_REQUESTS: https://github.com/Expensify/Expensify.cash/pull/1750
  env:
    PULL_REQUEST_NUMBER: 1751
Unexpected error occurred finding the StagingDeployCash! There may have been more than one open StagingDeployCash found, or there was some other problem with the Github API request. Error: Provided URL  is not a valid Github Issue or Pull Request!
    at Function.getIssueOrPullRequestNumberFromURL (/Users/runner/work/_actions/Expensify/Expensify.cash/master/.github/actions/createOrUpdateStagingDeploy/index.js:521:19)
Error: Error: Provided URL  is not a valid Github Issue or Pull Request!
    at /Users/runner/work/_actions/Expensify/Expensify.cash/master/.github/actions/createOrUpdateStagingDeploy/index.js:376:45
    at Function.map (/Users/runner/work/_actions/Expensify/Expensify.cash/master/.github/actions/createOrUpdateStagingDeploy/index.js:18563:24)
    at /Users/runner/work/_actions/Expensify/Expensify.cash/master/.github/actions/createOrUpdateStagingDeploy/index.js:374:50
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
Failed fetching data from Github! undefined
An error occurred! Error: Failed fetching data from Github
    at /Users/runner/work/_actions/Expensify/Expensify.cash/master/.github/actions/createOrUpdateStagingDeploy/index.js:56:19
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: Error: Failed fetching data from Github

https://github.com/Expensify/Expensify.cash/runs/2098738279?check_suite_focus=true

@AndrewGable
Copy link
Contributor

@roryabraham fixed that error: #1752

Back on the testing 🐴

@AndrewGable
Copy link
Contributor

Verified that the first set of tests pass ✅

Now working on verifying the 🔒 label works

@AndrewGable
Copy link
Contributor

AndrewGable commented Mar 12, 2021

Tested the 🔒 functionality in: #1754

Got an error:

Error: HttpError: Unable to create comment because issue is locked.
Error: Unable to create comment because issue is locked.

We think we know the fix

@roryabraham
Copy link
Contributor Author

roryabraham commented Mar 12, 2021

Noice, it worked

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants