Skip to content

Commit

Permalink
Merge pull request #75 from JasonEtco/updoots
Browse files Browse the repository at this point in the history
Updoots
  • Loading branch information
JasonEtco authored Dec 6, 2020
2 parents 2eba79b + a8825a8 commit be196d1
Show file tree
Hide file tree
Showing 4 changed files with 2,096 additions and 1,915 deletions.
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

0 comments on commit be196d1

Please sign in to comment.