Coder Social home page Coder Social logo

firebaseextended / action-hosting-deploy Goto Github PK

View Code? Open in Web Editor NEW
656.0 16.0 191.0 1.99 MB

Automatically deploy shareable previews for your Firebase Hosting sites

Home Page: https://firebase.google.com/docs/hosting/github-integration

License: Apache License 2.0

TypeScript 100.00%
firebase continuous-deployment github-actions firebase-hosting

action-hosting-deploy's People

Contributors

andreavaccari avatar bkendall avatar dependabot[bot] avatar developit avatar expatiating avatar jhuleatt avatar kroikie avatar mathiasbynens avatar mbleigh avatar mkdior avatar napei avatar pomle avatar rachelsaunders avatar steren avatar stewart42 avatar wokkaflokka avatar yurist38 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

action-hosting-deploy's Issues

Bot comment is updated instead of outdated and new one created

Problem

Comments in GitHub PRs are interspersed with the chronological commit history which indicates which part of the history the comment refers to (usually commits prior to the comment).

On initial deployment with this GitHub Action, the bot comment is created after the SHA of the first successful deployment. Subsequent deployments simply update the comment which does not shift where the comment is in the history. This could lead to confusion.

Proposed Solution

Instead of updating the comment with the new SHA and expiry date etc, the comment should be Hidden and marked as Outdated, and new one created with the new deployments information. This way, the deployment history is preserved and appears as expected within the GitHub PR UI.

Alternatively, since the only data that changes in the comment is expiry date and SHA, deleting the old comment and creating a new one would also be sufficient IMO.

Additional Info

  • While the comment itself has edit history it is not as clear as the proposed solution.
  • A hidden comment would be present on the page for N-1 successful deployments. Arguably a lot of visual noise.

Preview channel URL not registered in authorized domains

If I use cli(v8.12.1) to deploy to a preview channel, the preview channel URL is automatically registered to a Firebase Authentication's authorized domains, but not with this action(v0).

I expect the preview channel URL to be registered to the authorized domain just as it is with cli.

Deploy to multiple environments

Let's say we want to deploy a preview of one commit to two environments. In our build step we will provide different API base urls for each envirnoment, dev and qa.

Is there any way to achieve this?

I suspect we can do two deploy steps, but it's not clear how we display in each message which environment the link is for.

Authentication Whitelist

Preview Channels are not automatically added to authentication whitelist.

For preview channels to work they need to be added to the authentication whitelist, but for whatever reason they are not added on PRs

[BUG] Github Action deploy when install a new package

Action config

name: Deploy to Firebase Hosting on merge into the staging environment
'on':
  push:
    branches:
      - staging
jobs:
  build_and_deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: npm ci && npm run build:staging
      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: '${{ secrets.GITHUB_TOKEN }}'
          firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_SAASMARKETINGFORMULA }}'
          channelId: live
          projectId: xxxxxx
          target: xxxxx
        env:
          FIREBASE_CLI_PREVIEWS: hostingchannels

Error message

I'm getting this error when I install a new package and then push it to deploy by GitHub action
The error just reproduces when I install a new package
image

Expected behavior

Deploy successful

Actual behavior

Error when trying to deploy to Firebase Hosting

[BUG] UnhandledPromiseRejectionWarning: HttpError: Resource not accessible by integration

Action config

      - id: deploy-to-firebase
        name: Deploy to Firebase
        uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_*** }}"
          expires: 5d
          projectId: ***
          entryPoint: website/public
        env:
          FIREBASE_CLI_PREVIEWS: hostingchannels

Error message

Run FirebaseExtended/action-hosting-deploy@v0
  with:
    repoToken: ***
    firebaseServiceAccount: ***
  
    expires: 5d
    projectId: ***
    entryPoint: website/public
  env:
    SLACK_WEBHOOK_URL: ***
    FIREBASE_CLI_PREVIEWS: hostingchannels
(node:4203) UnhandledPromiseRejectionWarning: HttpError: Resource not accessible by integration
    at /home/runner/work/_actions/FirebaseExtended/action-hosting-deploy/v0/bin/action.min.js:1:29017
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:4203) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4203) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Expected behavior

  • No error in de log
  • Message in the pull request with url to the preview
  • Preview deployed on Firebase Hosting Preview channels

Actual behavior

  • Error message in the log (see above)
  • No deployment on Firebase Hosting Preview channels
  • No message in the pull request

Additional comment

One thing that is also a little bit weird in this case, is that the build doesn't fail. I would assume that if the deployment fails the build on Github Actions would also fail.

Hold Preview Hosting more than 30 days

The use case you're trying to solve

We like that everything is automatic, and uses github actions. However, we want to hold the preview longer than 30 days. Sort of like long running history.

Change to the action that would solve that use case

Allow for expiration to be longer then 30 days.

Other considerations

Question: Has anyone asked for longer expiration time? What were their solutions?

Multiple projects via .firebaserc

The docs state:

The project to deploy to. If you leave this blank, be sure to check in a .firebaserc file so the CLI knows what project to deploy to.

How does the GitHub Action know which project alias to target? Does the projectId field support lookup from .firebaserc via alias name?

Action creates two checks

When configured as recommended, the action creates seemingly duplicate checks (deploy_preview and Deploy Preview). Can we make it a single check instead?

Delete preview channel on close/merge

When a PR is merged or closed, is it possible to detect this and delete the associated preview channel?

I have set the expiry date to 30 days which isn't a problem but when dependabot or renovate decides it's time for 20 PRs then that's a lot of temporary channels being created. There is a limit of 50 preview channels in firebase (I think) and trying to add more fails with a 429. I set the expiry date to 30 days under the assumption that if I left the PR long enough the channel would expire and it wouldn't be able to redeploy a new one? Correct me if I'm wrong. Firebase also seems to have issues deleting expired channels as they sit there "pending" for a day or so before going.

Add note about PRs from Forks

PRs from forks don't have access to repository secrets, so the action can't deploy in this situation.

Consider adding some docs to explain this

firebase init hosting:github, 404 error if the repo belongs to an organization

First off, I'm brand new to firebase hosting and github actions, so it's entirely possible that I'm approaching this the wrong way, but I haven't found any mention of this being incorrect in the docs.

To reproduce

  1. Create an organization on Github.
  2. Upload your repo to your org and set it as the remote origin
  3. Locally, use the command firebase init hosting:github

I authenticate successfully, then I'm prompted to enter the name of the repo, and it even suggests the correct repo in the format my-org-name/my-repo-name. So, I enter that but get the error FirebaseError: HTTP Error: 404, Not Found

Analysis

Looking at the firebase-debug.log, it looks like the cli makes the assumption that the repo belongs to a user, which isn't correct in this case i.e. from what I entered, it's forming the request:
HTTP REQUEST GET https://api.github.com/repos/my-org-name/my-repo-name/actions/secrets/public-key?type=owner
but the API is expecting:
...api.github.com/repos/my-github-username/my-repo-name/...

However, if I enter my-github-username/my-repo-name at the prompt, I get the same error but that's because the repo doesn't exist under my account, it belongs to the org.

Maybe it's a limitation of Github's API? Or maybe your intention is that developers always fork the repo, so this is more of a documentation issue (or lack of knowledge on my behalf)?

To work around this, I'm going to transfer the repo to my account, but I thought I'd mention it here.

Error: channelID is currently required

Our hosting preview deploys randomly quit working last night. We have no changes on our end. Now it fails saying channelID is currently required. Haven't been able to find anything in the changelogs. Is there somewhere else I should be looking?

Action config

      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_LEADFERNO }}"
          projectId: leadferno
        env:
          FIREBASE_CLI_PREVIEWS: hostingchannels

Error message

Error: channelID is currently required

Expected behavior

It deploys

Actual behavior

It doesn't

Please try again in 30 seconds.

Hey,
I used firebase-tools to set-up the github action.
but i'm getting this error:

<p><b>502.</b> <ins>That’s an error.</ins>
<p>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.  <ins>That’s all we know.</ins>

is there a status page to follow?
or this error because of something I did from my end (permission error in Gcloud or something)

channelId not set dynamically

First off, love the potential of this action and I'm happy to contribute where help is needed.

On the latest Alpha release, although the docs state If you don't set it, a new channel will be created per-PR or per-branch, I receive the following error with leaving channelId blank:

  /home/runner/work/my-repo/my-repo/node_modules/.bin/firebase hosting:channel:deploy  --project my-project --json
  ***
    "status": "error",
    "error": "channelID is currently required"
  ***
  ***
    "status": "error",
    "error": "channelID is currently required"
  ***

`output.urls` consumption issues

It appears passing data as arrays is not natively supported by GitHub Actions and thus each consumer of the outputs.urls would need to support consuming arrays by converting from a string.

When first using the Hosting Channel Action I hard coded the URL for my test PR into the Lighthouse step. After successful testing, I changed the code to use the urls output from the Firebase Action and began seeing "Invalid URL" errors with Lighthouse.

My GitHub Action YAML and changes

name: Deploy to Hosting Channel on PR
"on": pull_request
jobs:
  build_deploy_lighthouse:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Deploy to Firebase Hosting Channel
        id: deploy_firebase_hosting_channel
        uses: FirebaseExtended/[email protected]
        with:
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_REDACTED }}"
          projectId: REDACTED
        env:
          FIREBASE_CLI_PREVIEWS: hostingchannels
      - name: Run Lighthouse on urls and validate with lighthouserc
        uses: treosh/lighthouse-ci-action@v3
        with:
-		   urls: https://redacted--pr51-fix-hosting-channels-rwjjf6g3.web.app
+          urls: ${{ steps.deploy_firebase_hosting_channel.outputs.urls }}
          configPath: ".lighthouserc.json"
          runs: 3

Lighthouse input config when hard coded URL

  Input args: ***
    "urls": [
      "redacted--pr51-fix-hosting-channels-rwjjf6g3.web.app"
    ],

This worked.

New Lighthouse input config

  Input args: ***
    "urls": [
      "[\"https://redacted--pr51-fix-hosting-channels-rwjjf6g3.web.app\"]"
    ],

Note the double array.

Lighthouse Error

  Running Lighthouse 3 time(s) on ["redacted--pr51-fix-hosting-channels-rwjjf6g3.web.app"]
  ...
  Sun, 27 Sep 2020 05:16:17 GMT ChromeLauncher Killing Chrome instance 2891
  Runtime error encountered: The URL you have provided appears to be invalid.
  LHError: INVALID_URL
      at Function.run (/home/runner/work/_actions/treosh/lighthouse-ci-action/v3/node_modules/lighthouse/lighthouse-core/runner.js:78:17)
      at lighthouse (/home/runner/work/_actions/treosh/lighthouse-ci-action/v3/node_modules/lighthouse/lighthouse-core/index.js:48:17)
      at runLighthouse (/home/runner/work/_actions/treosh/lighthouse-ci-action/v3/node_modules/lighthouse/lighthouse-cli/run.js:224:32)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
  Error: LHCI 'collect' has encountered a problem.

Lighthouse correctly fails to pass ["redacted--pr51-fix-hosting-channels-rwjjf6g3.web.app"] as an URL.

Lighthouse Action urls input

Lighthouse's urls input usage is described as an array of URLs, but like so:

urls: |
  url-1.com
  url-2.com

And so the code - https://github.com/treosh/lighthouse-ci-action/blob/3f01a66925eae1613cb01504ae14ddb29b76cf0d/src/index.js#L32 - does not perform any checks to see if the first input value is a JSON.stringified array, leading to my error.

Workaround

  urls: ${{ steps.deploy_firebase_hosting_channel.outputs.details_url }}

works as expected.

I understand this issue is less of a Firebase Hosting Action issue and so there may be no fix to this, but for future users I am commenting anyway.

Unauthorized domain for build preview channel deploy

I am using Google sign-in provider which does not work when the hosting deploy bot deploys it when a PR is created on a preview channel, as the domain name is different than the one mentioned in the firebase config.

Please let me know if any further information is required.

firebase init hosting:github stuck on 'authentication...'

Using firebase cli version 8.12.1
I have existing project with hosting configured
Steps:

  1. ran the command firebase init hosting:github to configure the new feature of github action
  2. Browser opened to authenticate github account
  3. After press on allow permission on github page, redirected to a url like: 'http://localhost:9005/?code< Some Hash Code >=&state=1055088609'
  4. Response from url: This site can’t be reached. localhost refused to connect.
  5. firebase cli is in state 'Waiting for authentication...'
  6. After ctrl+c the command, and re-running it, And pressing on the link at the shell
    https://github.com/login/oauth/authorize?client_id=< Some Hash Code >&redirect_uri=http%3A%2F%2Flocalhost%3A9005&scope=read%3Auser%20repo%20public_repo''
    broswser is imeedietly redirected to the redirect url at step 3, Without going through grant permission again

Firebasestore

  <script src="/__/firebase/8.3.1/firebase-app.js"></script>
  <script src="/__/firebase/8.3.1/firebase-auth.js"></script>
  <script src="/__/firebase/8.3.1/firebase-firestore.js"></script>

FirebaseAuth

The use case you're trying to solve

Change to the action that would solve that use case

Other considerations

Output computed `channelId`

Setting the channelId is a nice feature, but it would be nice to output the set channelId (regardless of origin) to be consumed in later steps.

Using this action with a self-hosted runner

Thanks a lot for this great action. It's been working great out-of-box with GitHub-hosted runners, but just wanted to give a tip if you use a self-hosted runner. In my case I set up the runner on a VM based on Ubuntu 18.04 and I could only get the action to run if I set npm install --unsafe-perm -g firebase-tools or npm config set unsafe-perm true in a previous step:

name: Deploy to Preview Channel

on:
  pull_request:
    # Optionally configure to run only for specific files. For example:
    # paths:
    # - "website/**"

jobs:
  build_and_preview:
    # runs-on set to self-hosted instead of ubuntu-latest
    runs-on: self-hosted 
    steps:
      - uses: actions/checkout@v2
      # To get firebase-tools to install properly, add the following build step:
      - run: npm config set unsafe-perm true
      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
          expires: 30d
          projectId: your-Firebase-project-ID
        env:
          FIREBASE_CLI_PREVIEWS: hostingchannels

I am not sure if this is true in general for self-hosted runners or is specific to firebase-tools, but this issue led me to the solution. Anyway, hope this saves folks a couple of minutes here or there.

Retry with --debug

If the deploy CLI command fails, retry with the --debug flag enabled so it is easier to tell what went wrong

[BUG] npm ERR! code ELIFECYCLE npm ERR! errno 1 when running GitHub action to deploy to website on push to master branch.

Action config

# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Live Channel
'on':
  push:
    branches:
      - master
jobs:
  build_and_deploy_to_live_website:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout branch
        uses: actions/checkout@v2

      - name: Install dependencies & build
        run: npm ci && npm run build

      - name: Deploy to Firebase
        uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: '${{ secrets.GITHUB_TOKEN }}'
          firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_MYPROJECT }}'
          channelId: live
          projectId: myproject
        env:
          FIREBASE_CLI_PREVIEWS: hostingchannels

Error message

Run npm ci && npm run build
npm WARN prepare removing existing node_modules/ before installation

> [email protected] postinstall /home/runner/work/sencha-web/sencha-web/node_modules/babel-runtime/node_modules/core-js
> node -e "try***require('./postinstall')***catch(e)***"


> [email protected] install /home/runner/work/sencha-web/sencha-web/node_modules/waitlistapi/node_modules/chokidar/node_modules/fsevents
> node install.js


Skipping 'fsevents' build as platform linux is not supported

> [email protected] install /home/runner/work/sencha-web/sencha-web/node_modules/watchpack-chokidar2/node_modules/fsevents
> node install.js


Skipping 'fsevents' build as platform linux is not supported

> [email protected] postinstall /home/runner/work/sencha-web/sencha-web/node_modules/core-js
> node -e "try***require('./postinstall')***catch(e)***"


> [email protected] install /home/runner/work/sencha-web/sencha-web/node_modules/jest-haste-map/node_modules/fsevents
> node-gyp rebuild

make: Entering directory '/home/runner/work/sencha-web/sencha-web/node_modules/jest-haste-map/node_modules/fsevents/build'
  SOLINK_MODULE(target) Release/obj.target/.node
  COPY Release/.node
make: Leaving directory '/home/runner/work/sencha-web/sencha-web/node_modules/jest-haste-map/node_modules/fsevents/build'

> [email protected] postinstall /home/runner/work/sencha-web/sencha-web/node_modules/core-js-pure
> node -e "try***require('./postinstall')***catch(e)***"


> [email protected] install /home/runner/work/sencha-web/sencha-web/node_modules/webpack-dev-server/node_modules/fsevents
> node-gyp rebuild

make: Entering directory '/home/runner/work/sencha-web/sencha-web/node_modules/webpack-dev-server/node_modules/fsevents/build'
  SOLINK_MODULE(target) Release/obj.target/.node
  COPY Release/.node
make: Leaving directory '/home/runner/work/sencha-web/sencha-web/node_modules/webpack-dev-server/node_modules/fsevents/build'

> [email protected] install /home/runner/work/sencha-web/sencha-web/node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/linux-x64-83_binding.node
Download complete
Binary saved to /home/runner/work/sencha-web/sencha-web/node_modules/node-sass/vendor/linux-x64-83/binding.node
Caching binary to /home/runner/.npm/_cacache/node-sass/4.14.1/linux-x64-83_binding.node

> [email protected] postinstall /home/runner/work/sencha-web/sencha-web/node_modules/node-sass
> node scripts/build.js

Binary found at /home/runner/work/sencha-web/sencha-web/node_modules/node-sass/vendor/linux-x64-83/binding.node
Testing binary
Binary is fine

> [email protected] postinstall /home/runner/work/sencha-web/sencha-web/node_modules/@firebase/polyfill/node_modules/core-js
> node -e "try***require('./postinstall')***catch(e)***"


> [email protected] postinstall /home/runner/work/sencha-web/sencha-web/node_modules/protobufjs
> node scripts/postinstall

added 2116 packages in 39.928s

> [email protected] build /home/runner/work/sencha-web/sencha-web
> react-scripts build && mv build/index.html build/app.html

Creating an optimized production build...
Browserslist: caniuse-lite is outdated. Please run the following command: `npm update`

Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.

Failed to compile.

./src/components/Footer/Footer.js
  Line 158:19:  The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md  jsx-a11y/anchor-is-valid

./src/components/Navbar/Navbar.js
  Line 3:8:     'facebook' is defined but never used                                                                                                                                                                                                                                                                                                                                     no-unused-vars
  Line 4:8:     'instagram' is defined but never used                                                                                                                                                                                                                                                                                                                                    no-unused-vars
  Line 5:8:     'linkedin' is defined but never used                                                                                                                                                                                                                                                                                                                                     no-unused-vars
  Line 6:8:     'twitter' is defined but never used                                                                                                                                                                                                                                                                                                                                      no-unused-vars
  Line 138:17:  The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md  jsx-a11y/anchor-is-valid

./src/components/Header/Header.js
  Line 6:8:  'newsletterCover' is defined but never used  no-unused-vars


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `react-scripts build && mv build/index.html build/app.html`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2021-03-18T17_52_02_617Z-debug.log
Error: Process completed with exit code 1.

Expected behavior

Run through the entire workflow and deploy when I push to the master repo.

Actual behavior

Fails at the Install dependencies & build part of my GitHub action

Support multiple projects

Thank you for this action first of all. I have multiple projects, e.g. one for staging and one for production. It would be nice if that was supported by this action - service accounts etc. are needed

Support firebase.json that isn't in the root of the repo

For cases where the firebase.json file isn't at the root of the repo, we should allow configuration of the path to point to a specific spot.

For example:

- uses: FirebaseExtended/action-hosting-deploy@v0
  with:
    repoToken: "${{ secrets.GITHUB_TOKEN }}"
    firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
    projectId: my-project
    path: "./website" # Action will cd into this path before running

Static subdomain

When deploying to a new preview channel for every PR, could a static subdomain be used? For example:

hosting-project--pr0000-fix-issue-0000-stnczqi7.prodjectid.web.app

or even a static subdomain suffix, for example:

hosting-project--pr0000-fix-issue-0000-stnczqi7-prodjectid.web.app

This would help with configuring allowed hosts.

Specify `message` for each deployment

It would be amazing if this action would specify a build stamp for each deployment, similar to how you’d manually do:

firebase deploy --message "Deploy @ ${COMMIT_HASH}";

For deploy previews, the message could be something like:

firebase deploy --message "Deploy preview for PR #${PR_ID} @ ${COMMIT_HASH}";

This way, the Firebase Hosting dashboard always clearly shows which PR or merged commit each deployment corresponds to.

Output `firebase-tools` version during execution

Since firebase-tools is executed with npx the specific Firebase CLI version used is unknown. This would be useful information to output during execution for easier debugging.

npx should use the latest available on npm, but when debugging issues knowing this information is crucial.

I ma not able host my angular universal application in firebase

Earlier I was able to host my Angular Universal app in firebase but after updating the firebase tool My latest version is getting uploaded successfully but no changes I can see on the website.
I am using
ng add @angular/fire then
ng deploy to deploy my application
Please help

Unexpected token  in JSON at position 0

I'm getting the following error when I use this action: "Error: Unexpected token � in JSON at position 0".

The step in my workflow that produces this error does actually deploy both sites correctly, but seems to error on the success message that is returned in the "Deploying to production site" step.

The below are logs of the action.

Run FirebaseExtended/action-hosting-deploy@v0
Verifying firebase.json exists
Setting up CLI credentials
Deploying to production site
/usr/local/bin/npx firebase-tools deploy --only hosting --project MY_PROJECT_ID --json


"status": "success",
"result": ***
  "hosting": [
    "sites/MY_SITE_A/versions/VERSION_A",
    "sites/MY_SITE_B/versions/VERSION_B"
  ]
***

Error: Unexpected token � in JSON at position 0

[BUG] Cannot use GitHub bot account for comment

We have a bot user account for all of our CI notifications that go back to PRs. It doesn't seem we can use this account with this action, and it needs to come from the "actions-bot" instead, which is the default GITHUB_TOKEN.

Action config

    - name: Preview CMS
      uses: FirebaseExtended/action-hosting-deploy@v0
      with:
        repoToken: ${{ secrets._GITHUB_ACCESS_TOKEN }} # we'd like to use our own user repo token  here
        firebaseServiceAccount: ${{ secrets.GCP_SA_KEY_DEV }}
        projectId: ${{ env.PROJECT_ID }}
        target: cms
        expires: 14d
      env:
        FIREBASE_CLI_PREVIEWS: hostingchannels

Error message

Run FirebaseExtended/action-hosting-deploy@v0
(node:3122) UnhandledPromiseRejectionWarning: HttpError: You must authenticate via a GitHub App.
    at /home/runner/work/_actions/FirebaseExtended/action-hosting-deploy/v0/bin/action.min.js:1:29017
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:3122) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:3122) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Expected behavior

We can use any repoToken that is authenticated for the repository

Actual behavior

Action only works with GITHUB_TOKEN

502 error on preview deployment.

In my branch feature/event-input-form, deployment to hosting preview channel always failed with 502 error.

  /opt/hostedtoolcache/node/14.13.1/x64/bin/npx firebase-tools hosting:channel:deploy pr22-feature_event-input- --expires 10d --project ??? --json
  ***
    "status": "error",
    "error": "HTTP Error: 502, Unknown Error"
  ***
  ***
    "status": "error",
    "error": "HTTP Error: 502, Unknown Error"
  ***

But in another branch named feature/event-input, deployed successfully.

I think CHANNEL_ID ( pr22-feature_event-input- ) which end with - cause the error.

In this code, clipped branch name might have - at end of string.

const branchName = ghContext.payload.pull_request.head.ref.substr(0, 20);

Anyone know such rules about CHANNEL_ID?

ref: https://firebase.google.com/docs/hosting/manage-hosting-resources

Channel ID from Commit

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.