Skip to content

Commit 06c7054

Browse files
authored
fix(test): added write perms to integration test workflow (#228)
and fixed hackmd by pulling from #226
1 parent d06765f commit 06c7054

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- main
77

8+
permissions:
9+
issues: write
10+
contents: read
11+
812
jobs:
913
test:
1014
runs-on: ubuntu-latest

lib/notes.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@
33
const { default: HackMD } = require('@hackmd/api')
44
const defaultNotesTemplate = require('./default-notes-template')
55

6-
module.exports.create = function createNote (notesTemplate, opts) {
6+
module.exports.create = async function createNote (notesTemplate, opts) {
77
const note = typeof notesTemplate === 'function' ? notesTemplate(opts) : notesTemplate || defaultNotesTemplate(opts)
8-
const hackmd = new HackMD()
98

10-
return hackmd.newNote(note)
9+
try {
10+
const hackmd = new HackMD()
11+
return await hackmd.newNote(note)
12+
} catch (e) {
13+
console.error('failed to create hackMD note:', e.message)
14+
console.log(`note would have been:\n${note}`)
15+
return null
16+
}
1117
}
1218

1319
async function getNotesTemplate (client, opts) {

0 commit comments

Comments
 (0)