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

Implement restore-variable to clean our actions #239

Merged
merged 11 commits into from
Jan 11, 2021

Conversation

Demmonius
Copy link
Collaborator

@Demmonius Demmonius commented Jan 9, 2021

Use https://github.com/UnlyEd/github-action-store-variable to share our variables across different jobs, thus reducing the code needed and avoiding code duplication as much as possible.

Also, it fixes an issue with E2E tests when deploying multiple commits in parallel, because we don't mistakenly await for the latest Vercel deployment, but await for the correct deployment instead.

Status

This PR only affects "staging" for now, we'll make another one that changes the "production" script.

Also, we'll change the github action implementation to restore variables as ENV variables for use of writing/DX. (later)

@github-actions
Copy link

github-actions bot commented Jan 9, 2021

✅  Deployment SUCCESS
Commit 19d11b0 successfully deployed to https://nrn-v2-mst-aptd-at-lcz-sty-c1-gz3fryxf5.vercel.app
Deployment aliased as nrn-v2-mst-aptd-at-lcz-sty-c1-implement-s.vercel.app

@github-actions
Copy link

github-actions bot commented Jan 9, 2021

✅  E2E tests SUCCESS for commit 19d11b0 previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-gz3fryxf5.vercel.app

@github-actions
Copy link

github-actions bot commented Jan 9, 2021

✅  Deployment SUCCESS
Commit ce5dec6 successfully deployed to https://nrn-v2-mst-aptd-at-lcz-sty-c1-96zii3joa.vercel.app
Deployment aliased as nrn-v2-mst-aptd-at-lcz-sty-c1-implement-s.vercel.app

@github-actions
Copy link

github-actions bot commented Jan 9, 2021

✅  E2E tests SUCCESS for commit ce5dec6 previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-96zii3joa.vercel.app

@github-actions
Copy link

✅  Deployment SUCCESS
Commit b41c89e successfully deployed to https://nrn-v2-mst-aptd-at-lcz-sty-c1-3a7n8jpme.vercel.app
Deployment aliased as nrn-v2-mst-aptd-at-lcz-sty-c1-implement-s.vercel.app

@github-actions
Copy link

✅  E2E tests SUCCESS for commit b41c89e previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-3a7n8jpme.vercel.app

@github-actions
Copy link

✅  Deployment SUCCESS
Commit e4a47bb successfully deployed to https://nrn-v2-mst-aptd-at-lcz-sty-c1-9bjk35acb.vercel.app
Deployment aliased as nrn-v2-mst-aptd-at-lcz-sty-c1-implement-s.vercel.app

@@ -254,7 +230,7 @@ jobs:
env:
VERCEL_TOKEN: ${{ secrets.VERCEl_TOKEN }}
with:
deployment-url: ${{ env.VERCEL_DEPLOYMENT }} # Must only contain the domain name (no http prefix, etc.)
deployment-url: ${{ fromJson(steps.restore-variable.outputs.variables).VERCEL_DEPLOYMENT_DOMAIN }} # Must only contain the domain name (no http prefix, etc.)
Copy link
Member

Choose a reason for hiding this comment

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

@Demmonius Is there a better (shorter) way to do this?

Can't be variables automatically added to the ENV?

${{ env.VERCEL_DEPLOYMENT_DOMAIN }}

instead of 

${{ fromJson(steps.restore-variable.outputs.variables).VERCEL_DEPLOYMENT_DOMAIN }}

It would simplify writing a lot.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes that's possible, I'll try to implement it asap

@github-actions
Copy link

✅  E2E tests SUCCESS for commit e4a47bb previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-9bjk35acb.vercel.app

@github-actions
Copy link

✅  Deployment SUCCESS
Commit 1a29dc7 successfully deployed to https://nrn-v2-mst-aptd-at-lcz-sty-c1-bgq9cntdi.vercel.app
Deployment aliased as nrn-v2-mst-aptd-at-lcz-sty-c1-implement-s.vercel.app


# Checking if a webhook url is defined
if [ -n "$VERCEL_DEPLOYMENT_COMPLETED_WEBHOOK" ]; then
if [ -n "$VERCEL_DEPLOYMENT_COMPLETED_WEBHOOK" ]; then
Copy link
Member

Choose a reason for hiding this comment

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

This might be outside this PR's scope, but if you know of any way to extract it as an external bash script, and call it as a package.json script, that'd be a great improvement for readability.

@github-actions
Copy link

❌  E2E tests FAILED for commit 1a29dc7 previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-bgq9cntdi.vercel.app
Download artifacts (screenshots + videos) from checks section

@github-actions
Copy link

✅  E2E tests SUCCESS for commit 1a29dc7 previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-bgq9cntdi.vercel.app

@github-actions
Copy link

✅  Deployment SUCCESS
Commit 93e031b successfully deployed to https://nrn-v2-mst-aptd-at-lcz-sty-c1-2v5sniwsi.vercel.app
Deployment aliased as nrn-v2-mst-aptd-at-lcz-sty-c1-implement-s.vercel.app

# On E2E failure, add a comment to the PR with additional information, if there is an open PR for the current branch
- name: Comment PR (E2E failure)
uses: peter-evans/create-or-update-comment@v1 # See https://github.com/peter-evans/create-or-update-comment
if: steps.pr_id_finder.outputs.number && failure()
if: fromJson(steps.restore-variable.outputs.variables).GITHUB_PULL_REQUEST_ID && success()
Copy link
Member

Choose a reason for hiding this comment

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

@Demmonius I've removed the step Finding Pull Request ID, but I'm not sure whether I should use fromJson(steps.restore-variable.outputs.variables).GITHUB_PULL_REQUEST_ID && success() or GITHUB_PULL_REQUEST_ID && success() here 🤔

Can you review?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It looks like to be right. What are you thinking about? GITHUB_PULL_REQUEST_ID isn't declare right?

@github-actions
Copy link

❌  E2E tests FAILED for commit 93e031b previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-2v5sniwsi.vercel.app
Download artifacts (screenshots + videos) from checks section

@github-actions
Copy link

✅  E2E tests SUCCESS for commit 93e031b previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-2v5sniwsi.vercel.app

@github-actions
Copy link

✅  Deployment SUCCESS
Commit 6bf3567 successfully deployed to https://nrn-v2-mst-aptd-at-lcz-sty-c1-lwbyqxpp3.vercel.app
Deployment aliased as nrn-v2-mst-aptd-at-lcz-sty-c1-implement-s.vercel.app

@github-actions
Copy link

❌  E2E tests FAILED for commit 6bf3567 previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-lwbyqxpp3.vercel.app
Download artifacts (screenshots + videos) from checks section

@github-actions
Copy link

✅  E2E tests SUCCESS for commit 6bf3567 previously deployed at https://nrn-v2-mst-aptd-at-lcz-sty-c1-lwbyqxpp3.vercel.app

@Vadorequest Vadorequest marked this pull request as ready for review January 11, 2021 08:05
@Vadorequest Vadorequest merged commit d6326d8 into v2-mst-aptd-at-lcz-sty Jan 11, 2021
@Vadorequest Vadorequest deleted the implement-store-variable-action branch January 11, 2021 08:05
Vadorequest added a commit that referenced this pull request Jan 11, 2021
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.

2 participants