fix: normalize cache-hit output to 'true'/'false' #245
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Action | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| merge_group: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| env: | |
| # renovate: datasource=github-releases depName=block/goose extractVersion=^v(?<version>.*)$ | |
| DEFAULT_GOOSE_VERSION: '1.15.0' | |
| jobs: | |
| test-ubuntu: | |
| name: Test on Ubuntu | |
| if: github.event_name == 'push' || github.event.pull_request.draft == false || github.event_name == 'merge_group' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Test action | |
| uses: ./ | |
| id: goose | |
| with: | |
| version: ${{ env.DEFAULT_GOOSE_VERSION }} | |
| - name: Verify installation | |
| run: | | |
| echo "Goose version: ${{ steps.goose.outputs.goose-version }}" | |
| echo "Goose path: ${{ steps.goose.outputs.goose-path }}" | |
| goose --version | |
| - name: Test goose command | |
| run: | | |
| which goose | |
| goose --help | |
| test-cache: | |
| name: Test caching | |
| if: github.event_name == 'push' || github.event.pull_request.draft == false || github.event_name == 'merge_group' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: First run (should install) | |
| id: first-run | |
| uses: ./ | |
| with: | |
| version: ${{ env.DEFAULT_GOOSE_VERSION }} | |
| - name: Check cache-hit output exists | |
| run: | | |
| CACHE_HIT="${{ steps.first-run.outputs.cache-hit }}" | |
| if [ -z "$CACHE_HIT" ]; then | |
| echo "::error::cache-hit output is empty" | |
| exit 1 | |
| fi | |
| echo "✓ cache-hit output is set to: '$CACHE_HIT'" | |
| - name: Remove binary | |
| run: rm ~/.local/bin/goose | |
| - name: Second run (should restore from cache) | |
| id: second-run | |
| uses: ./ | |
| with: | |
| version: ${{ env.DEFAULT_GOOSE_VERSION }} | |
| - name: Verify cache-hit is true on second run | |
| run: | | |
| if [ "${{ steps.second-run.outputs.cache-hit }}" != "true" ]; then | |
| echo "::error::Expected cache-hit='true' on second run, got '${{ steps.second-run.outputs.cache-hit }}'" | |
| exit 1 | |
| fi | |
| echo "✓ Second run cache-hit correctly reported as 'true'" | |
| - name: Verify cache worked | |
| run: goose --version | |
| test-version: | |
| name: Test different version | |
| if: github.event_name == 'push' || github.event.pull_request.draft == false || github.event_name == 'merge_group' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Test older version | |
| uses: ./ | |
| with: | |
| version: '1.11.0' | |
| - name: Verify correct version | |
| run: | | |
| VERSION=$(goose --version) | |
| echo "Installed: $VERSION" | |
| test-check-latest: | |
| name: Test check-latest input | |
| if: github.event_name == 'push' || github.event.pull_request.draft == false || github.event_name == 'merge_group' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Test with check-latest enabled | |
| id: check-latest | |
| uses: ./ | |
| with: | |
| check-latest: true | |
| - name: Verify latest version installed | |
| run: | | |
| INSTALLED_VERSION="${{ steps.check-latest.outputs.goose-version }}" | |
| echo "Installed version: $INSTALLED_VERSION" | |
| # Verify version format (supports pre-release tags) | |
| if ! [[ "$INSTALLED_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then | |
| echo "::error::Invalid version format: '$INSTALLED_VERSION'" | |
| exit 1 | |
| fi | |
| # Verify goose runs | |
| goose --version | |
| echo "✓ check-latest successfully installed version $INSTALLED_VERSION" | |