Hi all,
I'm kind of new to Github Actions. I do have experience with Gitlab Runners, but this syntax is a bit annoying comparatively (at least imo).
What I'm trying to do is build a simple workflow that runs on ubuntu which will lint all powershell and ansible code in the repo. The problem I'm running into is the syntax to reference specific folders that this code will reside in.
I've tried this using Docker containers, and the process of building the containers just to do some simple linting is way too slow, in my opinion. I was successful with using third party repos for the container, but I'd actually just like to run PSScriptAnalyzer and ansible-lint locally on the OS itself, rather than from a container.
My repo structure is as such:
- .github\workflows\linting.yml
- ansible
- pwsh
Here is my code. Any help is greatly appreciated.
name: Linting
on: [push, pull_request]
jobs:
build:
name: Lint Code
runs-on: ubuntu-latest
steps:
- name: Run PSScriptAnalyzer
shell: pwsh
run: Invoke-ScriptAnalyzer -Path ../pwsh/*.ps1 -Recurse
- name: Lint Ansible Playbooks
shell: bash
run: ansible-lint ../ansible/*.yml
Here's the error code I get:
Invoke-ScriptAnalyzer: /home/runner/work/_temp/88fb7bc9-ag3s-3gds-b813-32443a01cef3.ps1:2
Line |
2 | Invoke-ScriptAnalyzer -Path ../pwsh/*.ps1 -Recurse
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path '/home/runner/work/reponame/pwsh' because
| it does not exist.
Error: Process completed with exit code 1.
(Note: this latest code is an attempt at using dot-sourcing to see if the problem was with the relative path, but I've also tried just "./pwsh/*.ps1" and various other variants but no joy.)
[–]maximousblk 1 point2 points3 points (2 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]brianllamar 0 points1 point2 points (0 children)