{"id":22201654,"url":"https://github.com/uffizzicloud/preview-action","last_synced_at":"2025-07-27T04:30:45.817Z","repository":{"id":37950481,"uuid":"467672143","full_name":"UffizziCloud/preview-action","owner":"UffizziCloud","description":"GitHub Action to preview pull requests before merging","archived":false,"fork":false,"pushed_at":"2023-09-11T14:01:54.000Z","size":238,"stargazers_count":56,"open_issues_count":16,"forks_count":14,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-12-01T13:22:14.710Z","etag":null,"topics":["actions","continuous-delivery","continuous-integration","continuous-previews","docker","docker-compose","environments","ephemeral","github-actions","kubernetes","on-demand"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UffizziCloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-08T20:53:19.000Z","updated_at":"2024-07-15T15:19:52.000Z","dependencies_parsed_at":"2024-06-18T22:57:04.817Z","dependency_job_id":null,"html_url":"https://github.com/UffizziCloud/preview-action","commit_stats":{"total_commits":152,"total_committers":12,"mean_commits":"12.666666666666666","dds":0.618421052631579,"last_synced_commit":"bae81764cf3e0427042c148eb6059d91db9893de"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UffizziCloud%2Fpreview-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UffizziCloud%2Fpreview-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UffizziCloud%2Fpreview-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UffizziCloud%2Fpreview-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UffizziCloud","download_url":"https://codeload.github.com/UffizziCloud/preview-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227760023,"owners_count":17815626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","continuous-delivery","continuous-integration","continuous-previews","docker","docker-compose","environments","ephemeral","github-actions","kubernetes","on-demand"],"created_at":"2024-12-02T16:09:45.983Z","updated_at":"2024-12-02T16:09:46.760Z","avatar_url":"https://github.com/UffizziCloud.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# On-demand Preview Environments\n\nDeploy a Preview Environment (AKA \"Ephemeral Environment\") for every pull request. Supports APIs, frontends, backends, databases, microservices, binaries and command-line tools.\n\nUffizzi integrates as a step in your GitHub Actions pipeline to manage on-demand, ephemeral test environments for every feature branch/pull request. Preview Environments are deployed on [Uffizzi Cloud](https://uffizzi.com) (SaaS) or your own installation of [open-source Uffizzi](https://github.com/UffizziCloud/uffizzi_app) (self-hosting requires Kubernetes).\n\n## Reusable Workflow (recommended)\n\nWe've published a [Reusable Workflow](https://docs.github.com/en/actions/using-workflows/reusing-workflows#calling-a-reusable-workflow) for your GitHub Actions. This can handle creating, updating, and deleting Uffizzi Preview Environments. It will also publish Preview Environment URLs as a comment to your pull request issues. \n\n💡 We recommend using this reusable workflow instead of using the individual actions for [create](https://github.com/UffizziCloud/preview-action), [update](https://github.com/UffizziCloud/update-preview-action), and [delete](https://github.com/UffizziCloud/delete-preview-action).\n\n### Example usage\n\n```\n    uses: UffizziCloud/preview-action/.github/workflows/reusable.yaml@v2\n    if: ${{ github.event_name == 'pull_request' \u0026\u0026 github.event.action != 'closed' }}\n    with:\n      compose-file-cache-key: ${{ needs.render-compose-file.outputs.compose-file-cache-key }}\n      compose-file-cache-path: ${{ needs.render-compose-file.outputs.compose-file-cache-path }}\n      server: https://app.uffizzi.com/\n```\n\n\n\n### Workflow Calling Example\n\nThis example builds and publishes an image to Docker Hub for pull request events. It then renders a Docker Compose file from a template and caches it. Finally, it calls the reusable workflow to create, update, or delete the Preview Environment associated with the pull request.\n\n```yaml\nname: Build Images and Handle Uffizzi Previews.\n\non:\n  pull_request:\n    types: [opened,reopened,synchronize,closed]\n\njobs:\n  build-image:\n    name: Build and Push image\n    runs-on: ubuntu-22.04\n    outputs:\n      # You'll need this output later to render the Compose file.\n      tags: ${{ steps.meta.outputs.tags }}\n    steps:\n      - name: Login to DockerHub\n        uses: docker/login-action@v1\n        with:\n          username: ${{ secrets.DOCKERHUB_USERNAME }}\n          password: ${{ secrets.DOCKERHUB_PASSWORD }}\n      - name: Checkout git repo\n        uses: actions/checkout@v3\n      - name: Docker metadata\n        id: meta\n        uses: docker/metadata-action@v3\n        with:\n          images: example/image\n      - name: Build and Push Image to Docker Hub\n        uses: docker/build-push-action@v2\n        with:\n          push: true\n          tags: ${{ steps.meta.outputs.tags }}\n          labels: ${{ steps.meta.outputs.labels }}\n\n  render-compose-file:\n    name: Render Docker Compose File\n    runs-on: ubuntu-22.04\n    needs:\n      - build-image\n    outputs:\n      compose-file-cache-key: ${{ steps.hash.outputs.hash }}\n      compose-file-cache-path: docker-compose.rendered.yml\n    steps:\n      - name: Checkout git repo\n        uses: actions/checkout@v3\n      - name: Render Compose File\n        run: |\n          IMAGE=$(echo ${{ needs.build-image.outputs.tags }})\n          export IMAGE\n          # Render simple template from environment variables.\n          envsubst \u003c docker-compose.template.yml \u003e docker-compose.rendered.yml\n          cat docker-compose.rendered.yml\n      - name: Hash Rendered Compose File\n        id: hash\n        run: echo \"::set-output name=hash::$(md5sum docker-compose.rendered.yml | awk '{ print $1 }')\"\n      - name: Cache Rendered Compose File\n        uses: actions/cache@v3\n        with:\n          path: docker-compose.rendered.yml\n          key: ${{ steps.hash.outputs.hash }}\n\n  deploy-uffizzi-preview:\n    name: Use Remote Workflow to Preview on Uffizzi\n    needs: render-compose-file\n    uses: UffizziCloud/preview-action/.github/workflows/reusable.yaml@v2\n    if: ${{ github.event_name == 'pull_request' \u0026\u0026 github.event.action != 'closed' }}\n    with:\n      compose-file-cache-key: ${{ needs.render-compose-file.outputs.compose-file-cache-key }}\n      compose-file-cache-path: ${{ needs.render-compose-file.outputs.compose-file-cache-path }}\n      server: https://app.uffizzi.com/\n    permissions:\n      contents: read\n      pull-requests: write\n      id-token: write\n\n  delete-uffizzi-preview:\n    name: Use Remote Workflow to Delete an Existing Preview\n    uses: UffizziCloud/preview-action/.github/workflows/reusable.yaml@v2\n    if: ${{ github.event_name == 'pull_request' \u0026\u0026 github.event.action == 'closed' }}\n    with:\n      compose-file-cache-key: ''\n      compose-file-cache-path: docker-compose.rendered.yml\n      server: https://app.uffizzi.com/\n    permissions:\n      contents: read\n      pull-requests: write\n      id-token: write\n```\n\n### Workflow Inputs\n\n#### `compose-file-cache-key`\n\n(Required) Key of hashed compose file, using [GitHub's `cache` action](https://github.com/marketplace/actions/cache)\n\nNote that if this is an emtpy string, the reusable workflow will delete the preview associated with this Pull Request.\n\n#### `compose-file-cache-path`\n\n(Required) Path of hashed compose file, using [GitHub's `cache` action](https://github.com/marketplace/actions/cache)\n\n#### `server`\n\n(Required) `https://app.uffizzi.com/` or the URL of your Uffizzi installation\n\n#### `pr-number`\n\n(Optional) If you're calling this workflow from a workflow that's not triggered by `pull_request`, you may want to specify the PR number here.\n\n#### `git-ref`\n\n(Optional) If you're calling this workflow from a workflow that's not triggered by `pull_request`, you may want to specify the branch or other git reference here.\n\n#### `url-username` and `url-password`\n\n(Optional) If you're controlling access to the URLs of your Preview Environments, set the credentials here so the workflow can confirm successful deployment.\n\n#### `healthcheck-url-path`\n\nURL path that will be appended to the preview URL where the reusable workflow will check for the health of the preview. URL path has to start with `/`. Use this if the root URL of your application does not return an HTTP response code below 400.\n\n#### `description`\n\nIf specified, this text string will be added to each comment this workflow makes on the pull request issue. The default is a link to learn more about Uffizzi.\n\n## Uffizzi Accounts\n\nIf you're using the reusable workflow with [Uffizzi Cloud](https://uffizzi.com), an account and project will be created from your GitHub user and repository information when the workflow runs. If you're self-hosting open-source Uffizzi, you will need to create a Uffizzi user and project before running the workflow, then set `username`, `password`, and `project` inputs, where `project` is the Uffizzi project slug.\n\n### Example usage Uffizzi Cloud\n\n```yaml\nuses: UffizziCloud/preview-action@v2\nwith:\n  compose-file: 'docker-compose.uffizzi.yaml'\n  server: 'https://app.uffizzi.com'\nsecrets:\n  access-token: ${{ secrets.GITHUB_TOKEN }}\n  url-username: admin\n  url-password: ${{ secrets.URL_PASSWORD }}\npermissions:\n  contents: read\n  pull-requests: write\n  id-token: write\n```\n\n### Example usage self-hosted\n\n```yaml\nuses: UffizziCloud/preview-action@v2\nwith:\n  compose-file: 'docker-compose.uffizzi.yaml'\n  server: 'https://uffizzi.example.com'\n  username: 'j.doe@example.com'\n  password: ${{ secrets.UFFIZZI_PASSWORD }}\n  project: 'default'\npermissions:\n  contents: read\n  pull-requests: write\n  id-token: write\n```\n\n## Using this Preview Action itself (not recommended)\n\nIf you wish to use this action by itself outside of the reusable workflow described above, you can. It will only create new previews, not update nor delete them.\n\n### Inputs\n\n#### `compose-file`\n\n(Required) Path to a compose file within your repository\n\n#### `server`\n\n(Required) `https://app.uffizzi.com/` or the URL of your Uffizzi installation\n\n#### `username`\n\n(Self-hosted only) Uffizzi username\n\n#### `password`\n\n(Self-hosted only) Your Uffizzi password, specified as a GitHub Secret\n\n#### `project`\n\n(Self-hosted only) Uffizzi project slug\n\n#### `access-token`\n\n(Optional) The value of the `${{ secrets.GITHUB_TOKEN }}`. Used to avoid hitting the Github request rate limit.\n\n#### `ghcr-username` and `ghcr-access-token`\n\nYour GitHub username and the value of a [Github personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) with access to the `read:packages` scope.\n\nThis option is provided as a convenience to get started quickly. For sensitive repositories, we recommend instead connecting your Uffizzi account to GHCR via the web interface or by executing `uffizzi connect ghcr` from a trusted environment.\n\n#### `dockerhub-username` and `dockerhub-password`\n\nYour DockerHub username and password.\n\n### `acr-registry-url`, `acr-username`, and `acr-password`\n\nYour Azure Container Registry url, username and password.\n\n### `aws-registry-url`, `aws-access-key-id`, and `aws-secret-access-key`\n\nYour Amazon Web Services registry url, access key id and secret access key.\n\n### `gcloud-service-key`\n\nYour Google Cloud service key.\n\n### `docker-registry-url`, `docker-registry-username`, and `docker-registry-password`\n\nYour custom docker registry url, username and password.\n\n## Example usage\n\n```yaml\nuses: UffizziCloud/preview-action@v2\nwith:\n  compose-file: 'docker-compose.uffizzi.yaml'\n  username: 'admin@uffizzi.com'\n  server: 'https://app.uffizzi.com'\n  project: 'default'\n  password: ${{ secrets.UFFIZZI_PASSWORD }}\npermissions:\n  contents: read\n  pull-requests: write\n  id-token: write\n```\n\n## If you don't have a Uffizzi account\n\nIf you don't have a Uffizzi account, leave the username, password and project inputs blank. Uffizzi will create a Uffizzi account based on the information about the current repository and Github user.\n\nExample usage without an account:\n\n```yaml\nuses: UffizziCloud/preview-action@v2\nwith:\n  compose-file: 'docker-compose.uffizzi.yaml'\n  server: 'https://app.uffizzi.com'\npermissions:\n  contents: read\n  pull-requests: write\n  id-token: write\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuffizzicloud%2Fpreview-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuffizzicloud%2Fpreview-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuffizzicloud%2Fpreview-action/lists"}