FirebaseExtended / action-hosting-deploy

Automatically deploy shareable previews for your Firebase Hosting sites
https://firebase.google.com/docs/hosting/github-integration
Apache License 2.0
695 stars 202 forks source link

Separate GitHub Action Messages for Different Preview URLs #384

Open devj3ns opened 2 months ago

devj3ns commented 2 months ago

Describe the bug When deploying multiple preview channels (e.g., development and production) within a single GitHub Actions workflow, the bot currently updates a single comment in the PR conversation. Initially, it posts the production URL and then edits the same comment to include the development URL. This can be confusing and leads to a less clear separation of information.

Expected behavior The ideal behavior would be for the bot to create separate comments for each preview URL. This ensures clarity and improves the PR review process by distinctly separating the URLs for different environments (e.g., development and production).

Steps to reproduce

  1. Set up a GitHub Actions workflow to deploy both development and production versions of an application using FirebaseExtended/action-hosting-deploy.
  2. Trigger the workflow on a pull request.
  3. Observe that the bot updates a single comment with both URLs, rather than creating separate comments for each URL.
  4. Proposed solution
  5. Modify the action to create separate comments for each deployment when multiple preview channels are deployed within the same workflow. This would enhance the readability and organization of the PR conversation, especially in complex projects with multiple environments.

Example workflow snippet

deploy_dev:
  name: "Deploy DEV"
  runs-on: ubuntu-latest
  needs: build_dev
  steps:
    - name: 📚 Checkout repo
      uses: actions/checkout@v4

    - name: ⬇️ Download Development Artifact
      uses: actions/download-artifact@master
      with:
        name: build-dev
        path: build/web

    - name: 🎯 Deploy to firebase (Preview - DEV)
      uses: FirebaseExtended/action-hosting-deploy@v0
      with:
        repoToken: "${{ secrets.GITHUB_TOKEN }}"
        firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
        projectId: my-project-id
        channelId: dev-${{ github.event.pull_request.number }}
        expires: 30d

deploy_prod:
  name: "Deploy PROD"
  runs-on: ubuntu-latest
  needs: build_prod
  steps:
    - name: 📚 Checkout repo
      uses: actions/checkout@v4

    - name: ⬇️ Download Production Artifact
      uses: actions/download-artifact@master
      with:
        name: build-prod
        path: build/web

    - name: 🎯 Deploy to firebase (Preview - PROD)
      uses: FirebaseExtended/action-hosting-deploy@v0
      with:
        repoToken: "${{ secrets.GITHUB_TOKEN }}"
        firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
        projectId: my-project-id
        channelId: prod-${{ github.event.pull_request.number }}
        expires: 30d