-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
51 lines (46 loc) · 1.56 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const GhostAdminAPI = require('@tryghost/admin-api');
const showdown = require('showdown');
const fetch = require("node-fetch");
const core = require("@actions/core")
const github = require("@actions/github")
const name = core.getInput()
const converter = new showdown.Converter()
let htmlValue = null
// Configure the client
const api = new GhostAdminAPI({
url: 'https://blog-pr.casperlabs.io',
// Admin API key goes here
key: '5f492151f94320000142e86f:3a504ff9996824e0e5311113afe686541380e20290b9b4acad61f1de7403a771',
version: 'v2'
});
fetch('https://github.com/self-coding-crab/codesandbox-onmessage/blob/master/README.md')
.then(response => response.text())
.then(result => {
console.log('result', result)
api.posts.add({
title: 'Hello world',
html: result
}, {source: 'html'})
// .then(response => console.log(response))
// .catch(error => console.error(error))
});
console.log(htmlValue)
// Make an authenticated request
(async function main() {
try {
console.log('repo', github.repository, github.event.pull_request.number)
} catch (err) {
console.error(err);
process.exit(1);
}
})
// - name: get list of files in PR
// if: github.event.pull_request.merged
// run: |
// URL="https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files"
// FILES=$(curl -s -X GET -G $URL | jq -r '.[] | .filename')
// if echo $FILES | grep -q ".json"; then
// echo "json file changed!!"
// else
// echo "no json file changed!!"
// fi