BO02 - Create a route to the BackOffice, allowed to Organizers only #284
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Firebase Functions | |
on: | |
pull_request_target: | |
branches: [main] | |
jobs: | |
authorize: | |
environment: | |
${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository && 'external' || 'internal' }} | |
runs-on: ubuntu-latest | |
steps: | |
- run: true | |
test: | |
needs: authorize | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v7 | |
id: pr | |
with: | |
script: | | |
const { data: pullRequest } = await github.rest.pulls.get({ | |
...context.repo, | |
pull_number: context.payload.pull_request.number, | |
}); | |
return pullRequest | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{fromJSON(steps.pr.outputs.result).merge_commit_sha}} | |
- name: Cache firebase emulators | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/firebase/emulators | |
key: ${{ runner.os }}-firebase-emulators-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-firebase-emulators- | |
continue-on-error: true | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: pnpm/action-setup@v3 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- run: cd functions && pnpm install --no-frozen-lockfile | |
- run: pnpm install -g firebase-tools | |
- name: Make envfile for functions | |
uses: SpicyPizza/[email protected] | |
with: | |
envkey_PUBLIC_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }} | |
envkey_PUBLIC_FIREBASE_SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | |
envkey_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{secrets.FIREBASE_STORAGE_BUCKET}} | |
envkey_PUBLIC_FIREBASE_FUNCTIONS_REGION: ${{ vars.REGION }} | |
file_name: .env | |
directory: functions | |
- name: Make envfile | |
uses: SpicyPizza/[email protected] | |
with: | |
envkey_PUBLIC_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }} | |
envkey_PUBLIC_FIREBASE_SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | |
envkey_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{secrets.FIREBASE_STORAGE_BUCKET}} | |
envkey_PUBLIC_FIREBASE_FUNCTIONS_REGION: ${{ vars.REGION }} | |
file_name: .env | |
- run: cd functions && pnpm run build | |
- run: cd functions && pnpm run test |