name: Generate queries

on:
  push:
    branches:
      - develop

jobs:
  master:
    name: Generate Queries
    runs-on: ubuntu-22.04

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Setup node
        uses: actions/setup-node@v3
        with:
          node-version-file: '.nvmrc'
          # https://stackoverflow.com/questions/61010294/how-to-cache-yarn-packages-in-github-actions
          cache: yarn

      - name: Install root dependencies
        run: yarn install --frozen-lockfile

      - name: Generate queries
        run: node ./scripts/get-queries.js

      - uses: actions/upload-artifact@v2
        with:
          name: queries
          path: ./queries.graphql
