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 d1e01f2
Show file tree
Hide file tree
Showing 4 changed files with 376 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(/[/]$/, '') : '')
39 changes: 39 additions & 0 deletions .github/workflows/checkrun-completed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Cloudflare Pages Deployed

on:
check_run:
types: [completed]

jobs:
build:
name: Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.x'
cache: 'yarn'

- name: Set testing state
uses: thollander/actions-comment-pull-request@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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 d1e01f2

Please sign in to comment.