Skip to content

Generate and Commit GQL Types #6

Generate and Commit GQL Types

Generate and Commit GQL Types #6

name: Generate and Commit GQL Types
on:
schedule:
# Run the workflow every Monday at midnight (UTC)
- cron: '0 0 * * MON'
permissions:
contents: write # Allows for committing and creating pull requests
actions: write
jobs:
generate-gql-types:
name: Generating GQL Types 🦾
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [21.3.0]
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Yarn/Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install Dependencies
run: yarn install --immutable
- name: Generate GQL Types
run: yarn generate
- name: Check for changes
run: git diff --exit-code -- typedefs/
continue-on-error: true
# Commit and push changes if any exist
- name: Commit changes
if: failure()
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add typedefs/
git commit -m "chore: update gql types"
git push
# Create a pull request if changes were committed
- name: Create Pull Request
if: failure()
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update gql types"
title: "chore: update gql types"
body: "This PR updates the GraphQL types."
branch: "update-gql-types"