Giter Club home page Giter Club logo

github-action-psscriptanalyzer's Introduction

Ohai, I'm Brandon ๐Ÿ‘‹

I'm a Staff Site Reliability Engineer (SRE) at stackoverflow.com and a Microsoft MVP in Cloud and Datacenter Management.

I โค๏ธ PowerShell. I'm the creator of PoshBot and Terminal-Icons, the maintainer of psake, and a number of other open-source tools.

I love to build interesting and helpful open-source tools to make sysadmins, IT pros, and developers' lives easier.

ย ย  ย ย 

github-action-psscriptanalyzer's People

Contributors

alagoutte avatar crazycodeuk avatar devblackops avatar revolter avatar sleepysysadmin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

github-action-psscriptanalyzer's Issues

Make better use of GitHub Actions warnings and errors

I have a few suggestions for improvements. These are not tested, but should work ๐Ÿ˜€

Errors
Errors could be directly sent back to Actions by changing entrypoint.ps1 L35 to:

foreach ($i in $errors) {
    Write-Output "::error file=$($i.ScriptName),line=$($i.Line),col=$($i.Column)::$($i.RuleName) - $($i.Message)"
}

Warnings
Warnings could be directly sent back to Actions by changing entrypoint.ps1 L38 to:

foreach ($i in $warnings) {
    echo "::warning file=$($i.ScriptName),line=$($i.Line),col=$($i.Column)::$($i.RuleName) - $($i.Message)"
}

PSSA ParseError
PSSA also outputs "ParseErrors". These currently seem to be ignored by this Action, but could be reported with other errors like by changing entrypoint.ps1 L27 to:

$errors   = $issues.Where({($_.Severity -eq 'Error') -or ($_.Severity -eq 'ParseError')})

Reference: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message

Action started failing today because of empty `output:` entry in `actions.yml`

Hi,

The action started failing today, it seems something in Github changed that now it's failing actions with an empty output: entry in actions.yml:

##[error]devblackops/github-action-psscriptanalyzer/v2/action.yml (Line: 30, Col: 9): Unexpected value ''
##[error]devblackops/github-action-psscriptanalyzer/v2/action.yml (Line: 30, Col: 9): Unexpected value ''
##[error]System.ArgumentException: Unexpected type 'NullToken' encountered while reading 'outputs'. The type 'MappingToken' was expected.

(taken from this run: https://github.com/alpeb/linkerd2/runs/946382403?check_suite_focus=true )

Is anybody else experiencing the same issue?

Thanks!

No comment push on PR from fork

When use this PSSA Github Actions, there is no comment push on PR
and on github action log, i get :

Invoke-RestMethod : {"message":"Resource not accessible by integration","documentation_url":"https://developer.github.com/v3/issues/comments/#create-a-comment"}
At /entrypoint.ps1:61 char:5
+     Invoke-RestMethod @params > $null
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Method: POST, Reque\u2026application/json
}:HttpRequestMessage) [Invoke-RestMethod], HttpResponseException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
##[error]Docker run failed with exit code 1

You can look PowerAruba/PowerArubaCP#23 and https://github.com/PowerAruba/PowerArubaCP/pull/23/checks

No comment is posted on the PR

I used this config:

name: ci

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  lint:
    name: Run PSScriptAnalyzer
    runs-on: ubuntu-latest
    steps:
      - name: Checkout ๐Ÿ›Ž
        uses: actions/checkout@v2

      - name: Lint ๐Ÿ•ต๐Ÿปโ€โ™‚๏ธ
        uses: devblackops/github-action-psscriptanalyzer@master
        with:
          repoToken: ${{ secrets.GITHUB_TOKEN }}

and even though it finds:

image

no comment is posted on the PR.

SendComments Fails when from a Forked Repo, even after setting 'Send write tokens to workflows from fork pull requests.'

I get the failure
Invoke-RestMethod: /entrypoint.ps1:61 Line | 61 | Invoke-RestMethod @params > $null | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | {"message":"Resource not accessible by | integration","documentation_url":"https://docs.github.com/rest/reference/issues#create-an-issue-comment"}

when attempting to let this lint a PR from a forked repo. I have tried following articles telling me to turn on 'Send write tokens to workflows from fork pull requests' for the organization (which I assume the repos inside it would inherit), however within the org repo there isn't an individual setting for the repo to turn this on (it is at the org level only). Trying to figure out if I'm missing something in the XAML to ensure it uses the appropriate secrets token.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.