{"id":15290934,"url":"https://github.com/azure/aca-review-apps","last_synced_at":"2025-08-04T06:14:33.968Z","repository":{"id":58608743,"uuid":"532407594","full_name":"Azure/aca-review-apps","owner":"Azure","description":"Enable GitHub developers to create a new revision of Azure Container App for review by using GitHub Actions","archived":false,"fork":false,"pushed_at":"2024-06-12T01:58:48.000Z","size":4234,"stargazers_count":52,"open_issues_count":12,"forks_count":9,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-10-07T12:35:17.073Z","etag":null,"topics":["actions","azure","azure-container-apps","cicd","container","github","github-actions"],"latest_commit_sha":null,"homepage":"https://github.com/Azure/aca-review-apps","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Azure.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-04T00:59:30.000Z","updated_at":"2024-09-18T05:01:26.000Z","dependencies_parsed_at":"2024-06-21T05:45:06.642Z","dependency_job_id":"ff0f60f5-7744-4dab-87f0-d51ec3003393","html_url":"https://github.com/Azure/aca-review-apps","commit_stats":{"total_commits":94,"total_committers":9,"mean_commits":"10.444444444444445","dds":0.648936170212766,"last_synced_commit":"6f57512db05805d28f2da7c00a7e307b228a5ecb"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure%2Faca-review-apps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure%2Faca-review-apps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure%2Faca-review-apps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure%2Faca-review-apps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Azure","download_url":"https://codeload.github.com/Azure/aca-review-apps/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219869292,"owners_count":16555578,"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","azure","azure-container-apps","cicd","container","github","github-actions"],"created_at":"2024-09-30T16:10:10.170Z","updated_at":"2024-10-07T12:35:30.772Z","avatar_url":"https://github.com/Azure.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Action for Creating Azure Container App Revision\r\n\r\n[GitHub Actions](https://help.github.com/en/articles/about-github-actions) provides the flexibility to build automated workflows for the software development lifecycle.\r\n\r\n**aca-review-app** can be used to automate the workflow of creating a new revision of [Azure Container App](https://azure.microsoft.com/en-us/services/container-apps/) for review.\r\nThis action runs the code contained in the GitHub pull request as an app in the Container App. The review application is then created as a new revision with a Weight of 0, each with a unique URL that can be shared. This is a great way to review and test code changes. This action allows deactivating an app for review that has been created, triggered by the close of a pull request.\r\n\r\n\u003cimg width=\"640\" alt=\"image\" src=\"https://user-images.githubusercontent.com/15963767/195657236-54a6af81-61a2-4638-81c9-5e2313ddd6ed.png\"\u003e\r\n\r\n**aca-review-app** can also be configured to launch automatically with each pull request. By integrating with other github actions, it is also possible not only to create revisions, but also to comment the URL of the created revision in a pull request. For more information, please refer to the [eample workflow](./example/).\r\n\r\nLet's get started today with a [free Azure account](https://azure.com/free/open-source)!\r\n\r\nThe definition of this GitHub Action is in [action.yml](./action.yml).\r\n\r\n## End-to-End Sample Workflows\r\n\r\nThe **[```example/```](./example/)** in this repository contains a sample project to get started. Please read the hands-on documentation and start building.\r\n\r\n### Dependencies on other GitHub Actions\r\n\r\n* [Azure Login](https://github.com/Azure/login) Login with your Azure Credentials for Authentication. Once login is done, the next set of Azure Actions in the workflow can re-use the same session within the job.\r\n\r\n### Azure Service Principal for RBAC\r\n\r\nFor using any credentials like Azure Service Principal in your workflow, add them as [secrets](https://help.github.com/en/articles/virtual-enivronments-for-github-actions#creating-and-using-secrets-encrypted-variables) in the GitHub Repository and then refer them in the workflow.\r\n\r\n1. Download Azure CLI from [here](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest), run `az login` to login with your Azure Credentials.\r\n2. Run Azure CLI command to create an [Azure Service Principal for RBAC](https://docs.microsoft.com/en-us/azure/role-based-access-control/overview):\r\n\r\n  ```bash\r\n      az ad sp create-for-rbac --name \"myApp\" --role contributor \\\r\n                               --scopes /subscriptions/{subscription-id}/resourceGroups/{resource-group} \\\r\n                               --sdk-auth\r\n\r\n      # Replace {subscription-id}, {resource-group} with the subscription, resource group details of the WebApp\r\n      # The command should output a JSON object similar to this:\r\n\r\n    {\r\n      \"clientId\": \"\u003cGUID\u003e\",\r\n      \"clientSecret\": \"\u003cGUID\u003e\",\r\n      \"subscriptionId\": \"\u003cGUID\u003e\",\r\n      \"tenantId\": \"\u003cGUID\u003e\",\r\n      (...)\r\n    }\r\n  ```\r\n\r\n  \\* You can further scope down the Azure Credentials to the Web App using scope attribute. For example,\r\n\r\n  ```bash\r\n   az ad sp create-for-rbac --name \"myApp\" --role contributor \\\r\n                            --scopes /subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.Web/sites/{app-name} \\\r\n                            --sdk-auth\r\n\r\n  # Replace {subscription-id}, {resource-group}, and {app-name} with the names of your subscription, resource group, and Azure Web App.\r\n  ```\r\n\r\n3. Paste the json response from above Azure CLI to your GitHub Repository \u003e Settings \u003e Secrets \u003e Add a new secret \u003e **AZURE_CREDENTIALS**\r\n\r\n1. Now in the workflow file in your branch: `.github/workflows/workflow.yml` replace the secret in Azure login action with your secret (Refer to the example below)\r\n\r\n### Integration to leave comments on Pull Request\r\n\r\n#### Sample Snipet for the Review Revision Creation\r\n\r\nYou can pass the app URL for review to subsequent actions as follows.\r\n\r\n```yaml\r\n- name: Add revision to ACA\r\n  uses: Azure/aca-review-apps@v0.2.0\r\n  id: aca_new_revision\r\n  with:\r\n    resource-group: \u003cYOUR_RESOURCE_GROUP\u003e\r\n    name: \u003cYOUR_CONTAINER_APP_NAME\u003e\r\n    revision-name-suffix: \u003cSHORT_HASH\u003e\r\n    image: \u003cYOUR_CONTAINER_IMAGE\u003e\r\n\r\n- name: add new comment to PR\r\n  uses: peter-evans/create-or-update-comment@v2\r\n  with:\r\n    issue-number: ${{ github.event.pull_request.number }}\r\n    body: |\r\n      Revision ${{ env.CONTAINERAPP_NAME }}--${{ env.SHORT_HASH }} is created.\r\n      ${{ steps.aca_new_revision.outputs.app-url }}\r\n```\r\n\r\n#### Sample Snipet for the Review Revision Deactivation\r\n\r\nThis action can also automatically deactivate revisions.\r\nHowever, this flow must be triggered only when the pull request is closed. For more information, see the [sample](./example/) implementation.\r\n\r\n```yaml\r\n- name: Deactivate Preview revision on ACA\r\n  uses: Azure/aca-review-apps@v0.2.0\r\n  with:\r\n    resource-group: \u003cYOUR_RESOURCE_GROUP\u003e\r\n    name: \u003cYOUR_CONTAINER_APP_NAME\u003e\r\n    revision-name-suffix: \u003cSHORT_HASH\u003e\r\n    image: \u003cYOUR_CONTAINER_IMAGE\u003e\r\n    deactivate-revision-mode: true #IMPORTANT!!\r\n\r\n- name: Find Comment\r\n  uses: peter-evans/find-comment@v2\r\n  id: fc\r\n  with:\r\n    issue-number: ${{ github.event.pull_request.number }}\r\n    comment-author: \"github-actions[bot]\"\r\n    body-includes: Revision ${{ env.CONTAINERAPP_NAME }}--${{ env.SHORT_HASH }} is created.\r\n\r\n- name: add new comment to PR\r\n  if: steps.fc.outputs.comment-id != ''\r\n  uses: peter-evans/create-or-update-comment@v2\r\n  with:\r\n    comment-id: ${{ steps.fc.outputs.comment-id }}\r\n    edit-mode: replace\r\n    body: |\r\n      Revision ${{ env.CONTAINERAPP_NAME }}--${{ env.SHORT_HASH }} is deactivated.\r\n```\r\n\r\n### How to Develop/Test this Action\r\n\r\n#### Debug with breakpoints on Visual Studio Code\r\n\r\nThis action can be tried on not only GitHub Actions workflow but also your local PC or GitHub Codespaces.\r\n\r\nIf you use Visual Studio Code, debugging this action with breakpoints can be used by running [`Launch Program` configuration](./.vscode/launch.json#L10).\r\n![image](https://user-images.githubusercontent.com/4566555/189843026-61153630-4151-4e6c-8a1e-16163aec0910.png)\r\n\r\n#### Check workflow behavior without pushing to GitHub\r\n\r\nAlso, you can try to run your workflow with this action by executing [`npm run act`](./package.json#L8) on Visual Studio Code Remote-Container extension or GitHub Codespaces without pushing it to GitHub, because a devcontainer image for this repository includes `Docker-in-Docker` enabled devcontainer and `act`.\r\n\r\nFor more detail, refer to following links.\r\n\r\n* `Docker-in-Docker`: \u003chttps://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/docker-in-docker.md\u003e .\r\n* `act`: \u003chttps://github.com/nektos/act\u003e\r\n\r\n## Contributing\r\n\r\nThis project welcomes contributions and suggestions.  Most contributions require you to agree to a\r\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\r\nthe rights to use your contribution. For details, visit \u003chttps://cla.opensource.microsoft.com\u003e.\r\n\r\nWhen you submit a pull request, a CLA bot will automatically determine whether you need to provide\r\na CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions\r\nprovided by the bot. You will only need to do this once across all repos using our CLA.\r\n\r\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\r\nFor more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or\r\ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazure%2Faca-review-apps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazure%2Faca-review-apps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazure%2Faca-review-apps/lists"}