Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/action/result-poster/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const { Toolkit } = require('actions-toolkit')
const { context, github } = new Toolkit({ event: 'check_suite' })

const name = context.payload.check_suite.app.name;
const name = context.payload.check_suite.app.name
const conclusion = context.payload.check_suite.conclusion
const sha = context.payload.check_suite.head_sha;
const prs = context.payload.check_suite.pull_requests;
const sha = context.payload.check_suite.head_sha
const prs = context.payload.check_suite.pull_requests

if (name === 'Google Cloud Build' && conclusion === 'success' && prs[0]) {
github.issues.createComment(context.repo({
number: prs[0].number,
body: `Preview at: https://storage.googleapis.com/staging.nodejs.dev/${sha.slice(0,7)}/index.html`
}));
body: `Preview at: https://storage.googleapis.com/staging.nodejs.dev/${sha.slice(0, 7)}/index.html`
}))
}
3 changes: 1 addition & 2 deletions .github/action/result-poster/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "The WIP GitHub Action",
"main": "index.js",
"scripts": {
"pretest": "standard",
"test": "node test/smoke.js"
"test": "standard"
},
"repository": {
"type": "git",
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/result-poster-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI for Result Poster GitHub Action

on:
pull_request:
paths:
- ".github/workflows/result-poster-ci.yml"
- ".github/action/result-poster"

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Clone repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12

- name: Install npm dependencies
run: |
cd .github/action/result-poster
npm ci

- name: Run tests
run: |
cd .github/action/result-poster
npm test