action-hosting-deploy icon indicating copy to clipboard operation
action-hosting-deploy copied to clipboard

Channel ID from Commit

Open TheKingOfAtlantis opened this issue 3 years ago • 5 comments

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

TheKingOfAtlantis avatar Mar 08 '21 00:03 TheKingOfAtlantis

is there workaround?

othondev avatar Mar 22 '21 13:03 othondev

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.

sampi avatar Mar 24 '21 08:03 sampi

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)

pkanshu avatar Apr 01 '21 04:04 pkanshu

None of these 'solutions' work.

afroguy16 avatar Apr 25 '21 15:04 afroguy16

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

xtealer avatar Nov 08 '21 06:11 xtealer