Skip to content

Commit 8ec356b

Browse files
authoredOct 20, 2020
Merge pull request #12 from atlassian/bugfix/breaks-config-yml
Fix breakage of further Jira actions
2 parents 2a0d30f + e024cdf commit 8ec356b

File tree

5 files changed

+7
-13
lines changed

5 files changed

+7
-13
lines changed
 

‎.github/workflows/comment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ jobs:
3333
uses: ./
3434
with:
3535
issue: ${{ steps.create.outputs.issue }}
36-
comment: Test comment
36+
comment: Test comment ${{ github.event.compare }}

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To add comment to an issue you need to specify an issue key and a comment as act
1515
uses: atlassian/gajira-comment@master
1616
with:
1717
issue: INC-2
18-
comment: Hello from GitHub actions
18+
comment: ${{ github.event.pusher.name }} pushed to repository: ${{ github.event.repository.full_name }}
1919
```
2020
2121
You can interpolate fields from [GitHub event which triggered the workflow](https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#github-context) into a comment body. For example, if you set your workflow to be triggered on the `push` event, you can specify the pusher name in comment body by including `${{ github.event.pusher }}` field from the [push](https://developer.github.com/v3/activity/events/types/#pushevent) event:

‎action.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const _ = require('lodash')
21
const Jira = require('./common/net/Jira')
32

43
module.exports = class {
@@ -16,14 +15,10 @@ module.exports = class {
1615

1716
async execute () {
1817
const issueId = this.argv.issue
19-
const rawComment = this.argv.comment
18+
const { comment } = this.argv
2019

21-
_.templateSettings.interpolate = /{{([\s\S]+?)}}/g
22-
const compiled = _.template(rawComment)
23-
const interpolatedComment = compiled({ event: this.githubEvent })
24-
25-
console.log(`Adding comment to ${issueId}: ${interpolatedComment}`)
26-
await this.Jira.addComment(issueId, { body: interpolatedComment })
20+
console.log(`Adding comment to ${issueId}: \n${comment}`)
21+
await this.Jira.addComment(issueId, { body: comment })
2722

2823
return {}
2924
}

‎dist/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ async function exec () {
1919
}).execute()
2020

2121
if (result) {
22-
const yamledResult = YAML.stringify(result)
2322
const extendedConfig = Object.assign({}, config, result)
2423

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

27-
return fs.appendFileSync(cliConfigPath, yamledResult)
26+
return
2827
}
2928

3029
console.log('Failed to comment an issue.')

0 commit comments

Comments
 (0)
Failed to load comments.