diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index dbec832..ec220ea 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -8,7 +8,25 @@ on: workflow_dispatch: jobs: - build: + # test: + # runs-on: ubuntu-latest + # steps: + # - name: Checkout repository + # uses: actions/checkout@v4 + + # - name: Install prerequisites + # shell: pwsh + # run: | + # ./_build/bootstrap.ps1 + + # - name: Run Pester tests + # shell: pwsh + # run: | + # Invoke-Pester -Path "./src" + + deploy: + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + # needs: test runs-on: ubuntu-latest steps: - name: Checkout repository @@ -18,11 +36,7 @@ jobs: shell: pwsh run: | . "./_build/build.ps1" - - deploy: - needs: build - runs-on: ubuntu-latest - steps: + - name: Deploy to PowerShell Gallery env: PS_GALLERY_API_KEY: ${{ secrets.PS_GALLERY_API_KEY }} diff --git a/src/Export/GitHub/Invoke-GitHubRepository.Tests.ps1 b/src/Export/GitHub/Invoke-GitHubRepository.Tests.ps1 index aad40e3..5f451a3 100644 --- a/src/Export/GitHub/Invoke-GitHubRepository.Tests.ps1 +++ b/src/Export/GitHub/Invoke-GitHubRepository.Tests.ps1 @@ -54,10 +54,10 @@ Describe("Invoke-GitHubRepository") { It("Should throw if branch doesn't exist") { Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "config" } -MockWith { return $repoUrl } - Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "branch" -and $PassThruArgs[1] -eq "--show-current" } -MockWith { return "main" } + Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "branch" -and $PassThruArgs[1] -eq "--show-current" } -MockWith { return "blah" } Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "branch" -and $PassThruArgs[1] -eq "-r" } -MockWith { return @("origin/main") } Mock -CommandName "Start-Process" -MockWith {} - { Invoke-GitHubRepository -Branch } | Should -Throw -ExpectedMessage "Git branch 'main' does not exist at $repoUrl" + { Invoke-GitHubRepository -Branch } | Should -Throw -ExpectedMessage "Git branch 'blah' does not exist at $repoUrl" } } \ No newline at end of file