Skip to content

Commit

Permalink
Merge pull request #13 from atlassian/bugfix/breaking-other-actions-a…
Browse files Browse the repository at this point in the history
…fter

Fixed breaking other actions in the flow
  • Loading branch information
rudzon committed Oct 21, 2020
2 parents 634d97d + dfc7476 commit 0fb280d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/transition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}

- name: Create new issue
id: create
uses: atlassian/gajira-create@master
Expand All @@ -30,6 +30,12 @@ jobs:
Compare branch|${{ github.event.compare }} # https://developer.github.com/v3/activity/events/types/#webhook-payload-example-31
- name: Transition issue
uses: ./
with:
issue: ${{ steps.create.outputs.issue }}
transition: "To Do"

- name: Transition issue
uses: ./
with:
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const fs = require('fs')
const YAML = require('yaml')
const core = require('@actions/core')

const cliConfigPath = `${process.env.HOME}/.jira.d/config.yml`
const configPath = `${process.env.HOME}/jira/config.yml`
const Action = require('./action')

Expand All @@ -19,12 +18,11 @@ async function exec () {
}).execute()

if (result) {
const yamledResult = YAML.stringify(result)
const extendedConfig = Object.assign({}, config, result)

fs.writeFileSync(configPath, YAML.stringify(extendedConfig))

return fs.appendFileSync(cliConfigPath, yamledResult)
return
}

console.log('Failed to transition issue.')
Expand All @@ -38,14 +36,16 @@ async function exec () {
function parseArgs () {
const transition = core.getInput('transition')
const transitionId = core.getInput('transitionId')

if (!transition && !transitionId) {
// Either transition _or_ transitionId _must_ be provided
throw new Exception("Error: please specify either a transition or transitionId")
throw new Error('Error: please specify either a transition or transitionId')
}

return {
issue: core.getInput('issue'),
transition,
transitionId
transitionId,
}
}

Expand Down

0 comments on commit 0fb280d

Please sign in to comment.