Skip to content

Commit

Permalink
Merge pull request #42 from zentered/release
Browse files Browse the repository at this point in the history
EMS Release
  • Loading branch information
PatrickHeneise authored Apr 1, 2022
2 parents 2c628aa + 965f69f commit 280a901
Show file tree
Hide file tree
Showing 17 changed files with 8,516 additions and 11,052 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: github/super-linter@v4.9.0
env:
LINTER_RULES_PATH: /
FILTER_REGEX_EXCLUDE: (.*dist\/.*)|(.husky\/.*)
FILTER_REGEX_EXCLUDE: (.*dist\/.*)|(.husky\/.*)|(.test\/.*)
JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.json
VALIDATE_ALL_CODEBASE: true
VALIDATE_JAVASCRIPT_STANDARD: false
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
![Semantic Release](https://github.com/govolition/storefront-api/workflows/Semantic%20Release/badge.svg)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)

Retrieve the preview URL from the Cloudflare API, filtered by the repo and branch. The URL can then be used for further end-to-end tests, link checks and other PR integrations/actions.
Retrieve the preview URL from the Cloudflare API, filtered by the repository and branch. The URL can then be used for further end-to-end tests, link checks and other PR integrations/actions.

## Table of Contents

Expand Down Expand Up @@ -57,7 +57,7 @@ timeout-minutes: 10
In the repository, go to "Settings", then "Secrets" and add "CLOUDFLARE_API_TOKEN", the value you can retrieve on your [Cloudflare account](https://dash.cloudflare.com/profile/api-tokens). You also need to add:
- `CLOUDFLARE_ACCOUNT_EMAIL` (your login email)
- `CLOUDFLARE_ACCOUNT_EMAIL` (your login email, optional)
- `CLOUDFLARE_ACCOUNT_ID` (from the URL: `https://dash.cloudflare.com/123abc....`)

## Inputs
Expand All @@ -68,6 +68,7 @@ In the repository, go to "Settings", then "Secrets" and add "CLOUDFLARE_API_TOKE
| `wait_until_ready` | optional | Wait until the Cloudflare deployment is ready, defaults to "false" |
| `environment` | optional | Which Cloudflare deployment environments to allow. If set to null, doesn't filter deploys by environment. Defaults to "preview" |
| `commit_hash` | optional | Optional commit hash to filter deployments on. Useful when the same branch can have multiple deploys. |
| `branch` | optional | Optional branch name to filter deployments on. Useful when the branch name is not available in the action context. |

## Outputs

Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ inputs:
commit_hash:
description: "Optional commit hash to filter deployments on. Useful when the same branch can have multiple deploys."
required: false
branch:
description: "Optional branch name to filter deployments on. Useful when the branch name is not available in the action context."
required: false
name: Cloudflare Preview URL
outputs:
preview_url:
Expand Down
14 changes: 10 additions & 4 deletions cloudflare-statuscheck.mjs → cloudflare-statuscheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ export default async function waitForDeployment(
) {
const apiUrl = `https://api.cloudflare.com/client/v4/accounts/${accountId}/pages/projects/${projectId}/deployments`

const headers = accountEmail
? {
'X-Auth-Key': token,
'X-Auth-Email': accountEmail
}
: {
Authorization: `Bearer ${token}`
}

const { data } = await axios.get(apiUrl, {
headers: {
'X-Auth-Key': token,
'X-Auth-Email': accountEmail
},
headers,
responseType: 'json',
responseEncoding: 'utf8'
})
Expand Down
14 changes: 10 additions & 4 deletions cloudflare.mjs → cloudflare.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ export default async function getDeploymentUrl(
core.info(`Fetching from: ${apiUrl}`)
}

const headers = accountEmail
? {
'X-Auth-Key': token,
'X-Auth-Email': accountEmail
}
: {
Authorization: `Bearer ${token}`
}

const { data } = await axios.get(apiUrl, {
headers: {
'X-Auth-Key': token,
'X-Auth-Email': accountEmail
},
headers,
responseType: 'json',
responseEncoding: 'utf8'
})
Expand Down
Loading

0 comments on commit 280a901

Please sign in to comment.