File tree Expand file tree Collapse file tree 6 files changed +36
-26
lines changed
Expand file tree Collapse file tree 6 files changed +36
-26
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( http://keepachangelog.com/ )
66and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
77
8+ ## [ 1.1.0] - 2018-01-06
9+
10+ ### Changed
11+
12+ - Call PowerShell entrypoint script directly instead of calling bash first.
13+ - Allow disabling sending PSScriptAnalyzer results back to PR by setting the environment variable ` PSSCRIPTANALYZER_SEND_COMMENT ` to ` false ` or ` 0 ` .
14+
815## [ 1.0.1] - 2018-12-28
916
1017### Fixed
Original file line number Diff line number Diff line change @@ -39,9 +39,10 @@ action "PSScriptAnalyzer" {
3939## Environment Variables
4040
4141| Name | Default | Description |
42- | --------------------------------| --------- | -------------|
43- | PSSCRIPTANALYZER_ROOT | . | The root directory to run PSScriptAnalyzer on. By default, this is the root of the repository.
42+ | --------------------------------| ------| -------------|
43+ | PSSCRIPTANALYZER_ROOT | . | The root directory to run PSScriptAnalyzer on. By default, this is the root of the repository.
4444| PSSCRIPTANALYZER_SETTINGS_PATH | none | The path to a PSScriptAnalyser settings file to control rules to execute.
45+ | PSSCRIPTANALYZER_SEND_COMMENT | true | Enable/disable sending comments with PSScriptAnalyzer results back to PR.
4546
4647## Example
4748
Original file line number Diff line number Diff line change @@ -10,16 +10,15 @@ LABEL "com.github.actions.icon" = "box"
1010LABEL "com.github.actions.color" = "blue"
1111
1212LABEL "name" = "github-action-psscriptanalyzer"
13- LABEL "version" = "1.0.1 "
13+ LABEL "version" = "1.1.0 "
1414LABEL "repository" = "https://github.com/devblackops/github-action-psscriptanalyzer"
1515LABEL "homepage" = "https://github.com/PowerShell/PSScriptAnalyzer"
1616LABEL "maintainer" =
"Brandon Olin <[email protected] >" 1717
18- ADD entrypoint.sh /entrypoint.sh
19- ADD run.ps1 /run.ps1
18+ ADD entrypoint.ps1 /entrypoint.ps1
2019
2120COPY LICENSE README.md /
2221
23- RUN chmod +x /entrypoint.sh
22+ RUN chmod +x /entrypoint.ps1
2423
25- ENTRYPOINT ["/entrypoint.sh " ]
24+ ENTRYPOINT ["pwsh" , " /entrypoint.ps1 " ]
Original file line number Diff line number Diff line change @@ -37,6 +37,11 @@ action "PSScriptAnalyzer" {
3737## Environment Variables
3838
3939| Name | Default | Description |
40- | --------------------------------| --------- | -------------|
41- | PSSCRIPTANALYZER_ROOT | . | The root directory to run PSScriptAnalyzer on. By default, this is the root of the repository.
40+ | --------------------------------| ------| -------------|
41+ | PSSCRIPTANALYZER_ROOT | . | The root directory to run PSScriptAnalyzer on. By default, this is the root of the repository.
4242| PSSCRIPTANALYZER_SETTINGS_PATH | none | The path to a PSScriptAnalyser settings file to control rules to execute.
43+ | PSSCRIPTANALYZER_SEND_COMMENT | true | Enable/disable sending comments with PSScriptAnalyzer results back to PR.
44+
45+ ## Example
46+
47+ ![ ] ( media/example.jpg )
Original file line number Diff line number Diff line change @@ -51,19 +51,24 @@ if (($warnings -gt 0) -or ($infos -gt 0)) {
5151}
5252Write-Output $comment
5353
54+ # Comment threshold
55+
56+
5457# Send comment back to PR if any errors were found
55- $ghEvent = Get-Content - Path $env: GITHUB_EVENT_PATH | ConvertFrom-Json
56- if ($errors -gt 0 ) {
57- $params = @ {
58- Uri = $ghEvent.pull_request .' _links' .comments.href
59- Method = ' Post'
60- Headers = @ {
61- Authorization = " token $env: GITHUB_TOKEN "
58+ if ($env: PSSCRIPTANALYZER_SEND_COMMENT -ne ' false' -and $env: PSSCRIPTANALYZER_SEND_COMMENT -ne 0 ) {
59+ if ($errors -gt 0 ) {
60+ $ghEvent = Get-Content - Path $env: GITHUB_EVENT_PATH | ConvertFrom-Json
61+ $params = @ {
62+ Uri = $ghEvent.pull_request .' _links' .comments.href
63+ Method = ' Post'
64+ Headers = @ {
65+ Authorization = " token $env: GITHUB_TOKEN "
66+ }
67+ ContentType = ' application/json'
68+ Body = @ {body = $comment } | ConvertTo-Json
6269 }
63- ContentType = ' application/json'
64- Body = @ {body = $comment } | ConvertTo-Json
70+ Invoke-RestMethod @params > $null
6571 }
66- Invoke-RestMethod @params > $null
6772}
6873
6974exit $errors
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments