Skip to content

Commit

Permalink
ci: add Cloudflare Pages Deployed
Browse files Browse the repository at this point in the history
  • Loading branch information
SidStraw committed Aug 31, 2022
1 parent 77ff639 commit 38a923d
Show file tree
Hide file tree
Showing 4 changed files with 381 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .github/get-cloudflare-page-url.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* eslint-disable no-console */
const JSDOM = require('jsdom').JSDOM

const [html] = process.argv.slice(2)
const { document } = new JSDOM(html).window

const linkElement = document.querySelector('a')
console.log(linkElement?.href ? linkElement.href.replace(/[/]$/, '') : '')
44 changes: 44 additions & 0 deletions .github/workflows/checkrun-completed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Cloudflare Pages Deployed

on:
check_run:
types: [completed]

jobs:
build:
name: Test
runs-on: ubuntu-latest
if: github.event.check_run.pull_requests[0]

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.x'
cache: 'yarn'
- run: echo ${{ github.event.check_run.pull_requests }}
- run: echo ${{ github.event.check_run.pull_requests[0] }}
- run: echo ${{ github.event.check_run.pull_requests[0] == 'Object' }}

- name: Set testing state
uses: thollander/actions-comment-pull-request@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pr_number: 47
comment_includes: 'Playwright tests'
message: |
## 'Playwright tests'
testing...
- name: Install dependencies
run: yarn install

- name: Check object
run: |
cat << OBJECT
${{ toJson(github) }}
OBJECT
- name: Get Cloudflare Page URL
run: echo "DEPLOYMENT_URL=$(node ${GITHUB_WORKSPACE}/.github/get-cloudflare-page-url.js "${{ github.event.check_run.output.summary }}")"
continue-on-error: true
- run: echo $DEPLOYMENT_URL
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"vuepress": "^1.2.0"
},
"dependencies": {
"jsdom": "^20.0.0",
"vuepress-theme-sidstraw-blog": "file:./.vuepress/theme",
"yaml": "^1.10.0"
}
Expand Down
Loading

0 comments on commit 38a923d

Please sign in to comment.