This repository has been archived by the owner on Sep 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #684 from guardian/jw-test-gh-action
Add PR deployment action
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: PR Deployment | ||
|
||
on: | ||
pull_request: | ||
types: [labeled] | ||
|
||
jobs: | ||
pr_deployment: | ||
|
||
# We only want to run the app if the PR Deployment label has been added | ||
if: ${{ github.event.label.id == 2340278517 }} | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.npm | ||
key: node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: node- | ||
- name: install | ||
run: npm ci | ||
- name: run | ||
run: | | ||
npm install -g ngrok | ||
npm run watch & | ||
timeout 1h ngrok http 8080 -log=stdout -host-header=rewrite | \ | ||
grep --line-buffered -o 'https://.*' | \ | ||
xargs -L1 -I{} -t \ | ||
curl -X POST -H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} -d "{\"state\":\"success\", \"target_url\":\"{}\", \"context\":\"PR deployment\", \"description\":\"This PR is now live until `date -d "+1 hour" "+%a %H:%M"`. Click details to access it ->\"}" | ||
env: | ||
APIS_IMG_SALT: ${{ secrets.APIS_IMG_SALT }} | ||
CAPI_KEY: ${{ secrets.CAPI_KEY }} | ||
TZ: "/usr/share/zoneinfo/Europe/London" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters