Skip to content

Commit

Permalink
feat: adding comment block expand flag
Browse files Browse the repository at this point in the history
* feat: adding comment block expand flag
* chore: adding engines node  >=16 to packages.json
* chore: correcting licensing field
  • Loading branch information
RobertKelly authored Apr 1, 2022
1 parent 2b6d278 commit 55d2573
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 17 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/action-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,24 @@ jobs:
plan:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- run: yarn install
- run: yarn run build

- name: Pull Request Comment
uses: ./
with:
json-file: |
test-data/tf_test.json
test-data/tf_test2.json
test-data/tf_test3.json
- name: Pull Request Comment
uses: ./
with:
json-file: |
test-data/tf_test.json
test-data/tf_test2.json
test-data/tf_test3.json
- name: Pull Request Comment
uses: ./
with:
json-file: test-data/tf_test.json
expand-comment: 'true'

- name: Pull Request Comment
uses: ./
with:
json-file: test-data/tf_test.json
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install Dependencies
run: yarn install
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ inputs:
description: GitHub Token
required: false
default: '${{github.token}}'
expand-comment:
description: If true, expand the details comment by default
required: false
default: 'false'
runs:
using: node16
main: dist/index.js
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const trackedChanges = {
"update": "!"
}

const expandDetailsComment = core.getBooleanInput('expand-comment');
const myToken = core.getInput('github-token');
const octokit = github.getOctokit(myToken);

Expand Down Expand Up @@ -45,10 +46,12 @@ function fileComment(inputFile, showFileName) {
changes.filter(obj => obj.change.actions[0] === "update").length + ' to change, ' +
changes.filter(obj => obj.change.actions[0] === "delete").length + ' to destroy.</b>'

let openDetails = expandDetailsComment ? "open" : ""

let output = showFileName ? `\`${inputFile}\`` : ""

output += `
<details><summary>${summary}</summary>
<details ${openDetails}><summary>${summary}</summary>
${message}
</details>
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"type": "git",
"url": "https://github.com/liatrio/terraform-change-pr-commenter.git"
},
"engines": {
"node": ">=16"
},
"release": {
"branches": [
"main"
Expand Down Expand Up @@ -41,8 +44,8 @@
]
},
"keywords": [],
"author": "",
"license": "ISC",
"author": "Liatrio",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/liatrio/terraform-change-pr-commenter/issues"
},
Expand Down

0 comments on commit 55d2573

Please sign in to comment.