Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updoots #75

Merged
merged 4 commits into from
Dec 6, 2020
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
push:
branches:
- master
- main

jobs:
build:
Expand All @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x]
node-version: [12.x, 14.x]

steps:
- uses: actions/checkout@v1
Expand Down
13 changes: 8 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ const fm = require('front-matter')
const nunjucks = require('nunjucks')
const dateFilter = require('nunjucks-date-filter')

function setOutputs (tools, issue) {
tools.outputs.number = String(issue.data.number)
tools.outputs.url = issue.data.html_url
}

function listToArray (list) {
if (!list) return []
return Array.isArray(list) ? list : list.split(', ')
Expand All @@ -24,7 +29,7 @@ Toolkit.run(async tools => {

// Get the file
tools.log.debug('Reading from file', template)
const file = tools.getFile(template)
const file = await tools.readFile(template)

// Grab the front matter as JSON
const { attributes, body } = fm(file)
Expand Down Expand Up @@ -55,8 +60,7 @@ Toolkit.run(async tools => {
issue_number: existingIssue.number,
body: templated.body
})
core.setOutput('number', String(issue.data.number))
core.setOutput('url', issue.data.html_url)
setOutputs(tools, issue)
tools.exit.success(`Updated issue ${issue.data.title}#${issue.data.number}: ${issue.data.html_url}`)
} catch (err) {
tools.exit.failure(err)
Expand All @@ -76,8 +80,7 @@ Toolkit.run(async tools => {
milestone: tools.inputs.milestone || attributes.milestone
})

core.setOutput('number', String(issue.data.number))
core.setOutput('url', issue.data.html_url)
setOutputs(tools, issue)
tools.log.success(`Created issue ${issue.data.title}#${issue.data.number}: ${issue.data.html_url}`)
} catch (err) {
// Log the error message
Expand Down
Loading