name: Quality on: pull_request: workflow_dispatch: inputs: ignore-run-cache: description: 'Whether to ignore the run cache' required: false default: true ref-tag: description: 'overwrite the DOCKER_METADATA_OUTPUT_VERSION environment variable used by the make file' required: false default: '' jobs: quality: name: Ensure Quality if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.repository_id != '622995060') runs-on: ubuntu-22.04 timeout-minutes: 30 permissions: contents: read # We only need read access to the repository contents actions: write # We need write access to the actions cache env: CACHE_DIR: /tmp/login-run-caches # Only run this job on workflow_dispatch or pushes to forks steps: - uses: actions/checkout@v4 - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: | ghcr.io/zitadel/login tags: | type=raw,value=latest,enable={{is_default_branch}} type=ref,event=branch type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} - name: Set up Buildx uses: docker/setup-buildx-action@v3 # Only with correctly restored build cache layers, the run caches work as expected. # To restore docker build layer caches, extend the docker-bake.hcl to use the cache-from and cache-to options. # https://docs.docker.com/build/ci/github-actions/cache/ # Alternatively, you can use a self-hosted runner or a third-party builder that restores build layer caches out-of-the-box, like https://depot.dev/ - name: Restore Run Caches uses: actions/cache/restore@v4 id: run-caches-restore with: path: ${{ env.CACHE_DIR }} key: ${{ runner.os }}-login-run-caches-${{github.ref_name}}-${{ github.sha }}-${{github.run_attempt}} restore-keys: | ${{ runner.os }}-login-run-caches-${{github.ref_name}}-${{ github.sha }}- ${{ runner.os }}-login-run-caches-${{github.ref_name}}- ${{ runner.os }}-login-run-caches- - run: make login_quality env: IGNORE_RUN_CACHE: ${{ github.event.inputs.ignore-run-cache == 'true' }} DOCKER_METADATA_OUTPUT_VERSION: ${{ github.event.inputs.ref-tag || env.DOCKER_METADATA_OUTPUT_VERSION || steps.meta.outputs.version }} - name: Save Run Caches uses: actions/cache/save@v4 with: path: ${{ env.CACHE_DIR }} key: ${{ steps.run-caches-restore.outputs.cache-primary-key }} if: always()