Skip to content

Commit

Permalink
Removed recurring action
Browse files Browse the repository at this point in the history
  • Loading branch information
Demmonius committed Jun 16, 2020
1 parent 2e6075c commit 8c5fb51
Showing 1 changed file with 22 additions and 31 deletions.
53 changes: 22 additions & 31 deletions .github/workflows/deploy-zeit-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ jobs:
uses: actions/setup-node@v1 # Used to install node environment - XXX https://github.com/actions/setup-node
with:
node-version: '12.x' # Use the same node.js version as the one Zeit's uses (currently node12.x)
find-pr-id:
name: Finding Pull Request ID
runs-on: ubuntu-18.04
steps:
# We need to find the PR id. Will be used later to comment on that PR.
- name: Finding Pull Request ID
uses: jwalton/gh-find-current-pr@v1
id: pr_id_finder
if: always() # It forces the job to be always executed, even if a previous job fail.
with:
github-token: ${{ secrets.GITHUB_CI_PR_COMMENT }}
- name: Export it in the environment
run: echo "::set-env name=PR_ID::$PR_ID"
env:
PR_ID: ${{ steps.pr_id_finder.outputs.number }} # Passing output from previous action to export it for other jobs

# Starts a Zeit deployment, using the staging configuration file of the default institution
# The default institution is the one defined in the `now.json` file (which is a symlink to the actual file)
Expand Down Expand Up @@ -78,34 +93,26 @@ jobs:
ZEIT_TOKEN: ${{ secrets.ZEIT_TOKEN }} # Passing github's secret to the worker
CURRENT_BRANCH: ${{ github.ref }} # Passing current branch to the worker

# We need to find the PR id. Will be used later to comment on that PR.
- name: Finding Pull Request ID
uses: jwalton/gh-find-current-pr@v1
id: pr_id_finder
if: always() # It forces the job to be always executed, even if a previous job fail.
with:
github-token: ${{ secrets.GITHUB_CI_PR_COMMENT }}

# On deployment failure, add a comment to the PR
- name: Comment PR (Deployment failure)
uses: peter-evans/create-or-update-comment@v1
if: failure()
with:
token: ${{ secrets.GITHUB_CI_PR_COMMENT }}
issue-number: ${{ steps.pr_id_finder.outputs.number }}
issue-number: ${{ env.PR_ID }}
body: |
[GitHub Actions]
Deployment **FAILED**
Commit ${{ github.sha }} failed to deploy to ${{ env.ZEIT_DEPLOYMENT_URL }}
[click to see logs](https://github.com/UnlyEd/next-right-now/pull/${{ steps.pr_id_finder.outputs.number }}/checks)
[click to see logs](https://github.com/UnlyEd/next-right-now/pull/${{ env.PR_ID }}/checks)
# On deployment success, add a comment to the PR
- name: Comment PR (Deployment success)
uses: peter-evans/create-or-update-comment@v1
if: success()
with:
token: ${{ secrets.GITHUB_CI_PR_COMMENT }}
issue-number: ${{ steps.pr_id_finder.outputs.number }}
issue-number: ${{ env.PR_ID }}
body: |
[GitHub Actions]
Deployment **SUCCESS**
Expand Down Expand Up @@ -157,33 +164,25 @@ jobs:
name: videos
path: cypress/videos/

# We need to find the PR id. Will be used later to comment on that PR.
- name: Finding Pull Request ID
uses: jwalton/gh-find-current-pr@v1
id: pr_id_finder
if: always() # It forces the job to be always executed, even if a previous job fail.
with:
github-token: ${{ secrets.GITHUB_CI_PR_COMMENT }}

# On E2E failure, add a comment to the PR with additional information
- name: Comment PR (E2E failure)
uses: peter-evans/create-or-update-comment@v1
if: failure()
with:
token: ${{ secrets.GITHUB_CI_PR_COMMENT }}
issue-number: ${{ steps.pr_id_finder.outputs.number }}
issue-number: ${{ env.PR_ID }}
body: |
[GitHub Actions]
E2E tests **FAILED**
Download artifacts (screenshots + videos) from [`checks`](https://github.com/UnlyEd/next-right-now/pull/${{ steps.pr_id_finder.outputs.number }}/checks) section
Download artifacts (screenshots + videos) from [`checks`](https://github.com/UnlyEd/next-right-now/pull/${{ env.PR_ID }}/checks) section
# On E2E success, add a comment to the PR
- name: Comment PR (E2E success)
uses: peter-evans/create-or-update-comment@v1
if: success()
with:
token: ${{ secrets.GITHUB_CI_PR_COMMENT }}
issue-number: ${{ steps.pr_id_finder.outputs.number }}
issue-number: ${{ env.PR_ID }}
body: |
[GitHub Actions]
E2E tests **SUCCESS**
Expand Down Expand Up @@ -245,20 +244,12 @@ jobs:
minProgressiveWebAppScore: "50"
minSeoScore: "50"

# We need to find the PR id. Will be used later to comment on that PR.
- name: Finding Pull Request ID
uses: jwalton/gh-find-current-pr@v1
id: pr_id_finder
if: always() # It forces the job to be always executed, even if a previous job fail.
with:
github-token: ${{ secrets.GITHUB_CI_PR_COMMENT }}

# Add a comment to the PR with lighthouse report
- name: Comment PR (LightHouse report)
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ secrets.GITHUB_CI_PR_COMMENT }}
issue-number: ${{ steps.pr_id_finder.outputs.number }}
issue-number: ${{ env.PR_ID }}
# Report provided by steps.lighthouseCheck.outputs.lighthouseCheckResults is a string and need to be transform into an object.
# Then, using badges with results provided by `data[0].scores.<category>`
# data is an array containing results of every urls tested. Thankfully, we only test one url so we don't care about the index.
Expand Down

0 comments on commit 8c5fb51

Please sign in to comment.