w9jds / firebase-action

GitHub Action for interacting with Firebase
MIT License
926 stars 199 forks source link

Don't Require Keys For All Cases #196

Closed rgant closed 1 year ago

rgant commented 1 year ago

I just need this action to run the emulator for tests. Which means I don't need a FIREBASE_TOKEN or GCP_SA_KEY. This check before it is actually needed is not what I expect. Let the commands fail if they need a key and don't have one and report the error then would be better in my opinion.

Either FIREBASE_TOKEN or GCP_SA_KEY is required to run commands with the firebase cli https://github.com/w9jds/firebase-action/blob/b1bd6588c3a26cba12aa0b7e2c2e1dce23559cbc/entrypoint.sh#L6

rgant commented 1 year ago

Sigh, now I'm getting:

Error: npm is not a Firebase command

      - name: Run Rules Test
        uses: w9jds/firebase-action@master
        with:
          args: npm run test-rules
        env:
          GCP_SA_KEY: "{}"

Where test-rules is the script:

firebase emulators:exec --only firestore 'jasmine ./spec/firestore.rules.spec.ts'
rgant commented 1 year ago
    steps:
      - name: Automated Code Checks
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          cache: 'npm'
          node-version-file: '.nvmrc'

      - name: Install Firebase Tools
        run: npm install --global --no-audit --no-fund firebase-tools

      - name: Install Dependencies
        run: npm ci

      - name: Run Rules Test
        run: npm run test-rules

      - name: Cache firebase emulators
        uses: actions/cache@v3
        with:
          path: ${{ env.FIREBASE_EMULATORS_PATH }}
          key: ${{ runner.os }}-firebase-emulators-${{ hashFiles('emulator-cache/**') }}
        continue-on-error: true

Looks like this library just isn't anything I need. So I'll just manually install firebase-tools.