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
700 stars 201 forks source link

Channel ID from Commit #90

Open TheKingOfAtlantis opened 3 years ago

TheKingOfAtlantis commented 3 years ago

Currently have it setup that PR onto the dev or main branch trigger deployment of a preview, but would be great if a preview deployment could be triggered on a merge - Currently no channel id gets generated in this case resulting in an error and a failed action because no channel id is supplied

The sha or subject of the commit on a push could be used to generate the channel Id instead, allowing for this use case

othondev commented 3 years ago

is there workaround?

sampi commented 3 years ago

my workaround was to manually specify the channelId, loosely based on the current code: https://github.com/FirebaseExtended/action-hosting-deploy/blob/main/bin/action.min.js#L11267

- name: Deploy to Firebase (preview)
  uses: FirebaseExtended/action-hosting-deploy@v0
  with:
    repoToken: '${{ secrets.GITHUB_TOKEN }}'
    firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
    expires: 3d
    projectId: my-project-id
    channelId: 'pr-${{ github.event.number }}-${{ github.event.pull_request.head.ref }}'

I get a warning about unsupported characters (/), but the script replaces them with _ so it should be good as a temporary workaround.

pkanshu commented 3 years ago

Any constant channel ID can be provided in channelId key, e.g. preview. It need not be unique as Firebase appends a random hash to the channel ID while generating preview URL (Documentation link)

afroguy16 commented 3 years ago

None of these 'solutions' work.

xtealer commented 2 years ago

I use instead https://github.com/w9jds/firebase-action that covers similar functionality and has simpler usage.