Skip to content

Commit

Permalink
fixup! feat: create notes using HackMD
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarchini committed Nov 11, 2020
1 parent 7e4c8cf commit e04b9cb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/meeting.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Extracted from **<%= agendaLabel %>** labelled issues and pull requests from **<

## Links

* Minutes:
* Minutes: <%= meetingNotes || '' %>

### Joining the meeting

Expand Down
8 changes: 5 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ inputs:
required: true
createNotes:
description: 'Create meeting notes on HackMD'
default: false
default: 'false'
required: false
notesUserTemplate:
description: 'A name of an issue template (found in .github/ISSUE_TEMPLATES)'
default: 'meeting-notes.md'
description: 'A name of an issue template (found in .github/meet)'
default: 'notes.md'
required: false
outputs:
issueNumber:
description: 'If an issue was created, this will be its number'
Expand Down
9 changes: 2 additions & 7 deletions lib/default-notes-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ module.exports = ({ agendaIssues, agendaLabel, owner, repo, issue }) => {
*
## Agenda
## Announcements
## Agenda
*Extracted from **${agendaLabel}** labelled issues and pull requests from the **${owner} org** prior to the meeting.
${agendaIssues.map((i) => {
Expand All @@ -25,10 +25,5 @@ ${agendaIssues.map((i) => {
## Q&A, Other
## Upcoming Meetings
* **Node.js Foundation Calendar**: https://nodejs.org/calendar
Click \`+GoogleCalendar\` at the bottom right to add to your own Google calendar.
`
}
2 changes: 1 addition & 1 deletion lib/notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function getNotesTemplate (client, opts) {
const resp = await client.repos.getContents({
owner: opts.owner,
repo: opts.repo,
path: `.github/ISSUE_TEMPLATE/${opts.notesTemplate || 'meeting-notes.md'}`
path: `.github/meet/${opts.notesTemplate}`
})
if (resp.statusCode === 404) {
return false
Expand Down
10 changes: 6 additions & 4 deletions run.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const defaultNotesTemplate = require('./lib/default-notes-template')

opts.issue = issue.data

if (createNotes) {
if (createNotes === true || createNotes === 'true') {
let notesTemplate = defaultNotesTemplate
if (notesUserTemplate) {
try {
Expand All @@ -94,13 +94,15 @@ const defaultNotesTemplate = require('./lib/default-notes-template')
console.error(`notesTemplate missing or invalid (${notesUserTemplate}): ${e.message}`)
}
}
opts.meetingNotes = await notes.create(notesTemplate, { ...opts })
opts.meetingNotes = await notes.create(notesTemplate, opts)
console.log(`Notes created: ${opts.meetingNotes}`)
}

const updatedIssue = await meetings.setMeetingIssueBody(client, opts)
const updatedIssue = await meetings.setMeetingIssueBody(client, { ...opts, template })
if (!updatedIssue) {
return console.log('No issues to create')
return console.log('No issues to update')
} else {
return console.log('Issue updated successfully')
}
} catch (e) {
console.error(e)
Expand Down

0 comments on commit e04b9cb

Please sign in to comment.