Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github action not working #135

Closed
Dylan-Prins opened this issue Jul 17, 2022 · 2 comments
Closed

Github action not working #135

Dylan-Prins opened this issue Jul 17, 2022 · 2 comments

Comments

@Dylan-Prins
Copy link

Description of the issue

Thanks for the solution earlier, that works great. I have the same thing with the GitHub actions. It is like its scanning the repository files instead of the GitHub export

To Reproduce

Steps to reproduce the issue:

  test:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v3
    
    # Analyze Azure resources using PSRule for Azure
    - name: Analyze Azure template files
      uses: microsoft/ps-rule@v2.2.0
      with:
        modules: 'PSRule.Rules.GitHub'

Expected behaviour

A clear and concise description of what you expected to happen.

Error output

Capture any error messages and or verbose messages with -Verbose.

---
    ____  _____ ____        __
   / __ \/ ___// __ \__  __/ /__
  / /_/ /\__ \/ /_/ / / / / / _ \
 / ____/___/ / _, _/ /_/ / /  __/
/_/    /____/_/ |_|\__,_/_/\___/
Using PSRule v2.2.0+f3d21795d42759a906633118a58cdc088281b9dc
Using PSRule.Rules.GitHub v0.2.0
----------------------------
Explore documentation: https://aka.ms/ps-rule
Contribute and find source: https://github.com/microsoft/PSRule
Report issues: https://github.com/microsoft/PSRule/issues
PSRule.Rules.GitHub: https://github.com/Microsoft/PSRule.Rules.GitHub
----------------------------
From repository: https://github.com/dylanprins93/test
  on : refs/pull/4/merge
  at : a2d[41](https://github.com/dylanprins93/test/runs/7376898849?check_suite_focus=true#step:3:43)897310b1de1fcf17d[49](https://github.com/dylanprins93/test/runs/7376898849?check_suite_focus=true#step:3:51)021ebec63195cd6b
Warning: Using invariant culture may cause rule infomation to be displayed incorrectly. Consider using -Culture or set the Output.Culture option.
Warning: Target object 'test.md' has not been processed because no matching rules were found.
Warning: Target object 'refs/pull/4/merge' has not been processed because no matching rules were found.
Warning: Target object '.github/workflows/psrule.yml' has not been processed because no matching rules were found.
Rules processed: 0, failed: 0, errored: 0
Run dylanprins93/test/268[51](https://github.com/dylanprins93/test/runs/7376898849?check_suite_focus=true#step:3:53)20764 completed in 00:00:00.17682[61](https://github.com/dylanprins93/test/runs/7376898849?check_suite_focus=true#step:3:63)
---

Module in use and version:

  • Module: PSRule.Rules.GitHub
  • Version: [e.g. 0.2.0]

Captured output from $PSVersionTable:


Additional context

Add any other context about the problem here.

@BernieWhite
Copy link
Member

@Dylan-Prins Thank for logging the issue. Yes, GitHub Action will scan the repository by default. This differs slightly from the cmdlet, but is the most common scenario which is why it is the default.

Add the inputType: 'inputPath' parameter to the action to achieve the same result.

For example:

  test:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v3
    
    # Analyze Azure resources using PSRule for Azure
    - name: Analyze Azure template files
      uses: microsoft/ps-rule@v2.2.0
      with:
        modules: 'PSRule.Rules.GitHub'
        inputType: 'inputPath'

@Dylan-Prins
Copy link
Author

Indeed this works. I was expecting that with 'repository' that the module would find the json file and then have the same results...
Thanks anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants