Update GraphQL Schema #684
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: Update GraphQL Schema | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
update: | |
name: Update schema | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4 | |
with: | |
node-version-file: .node-version | |
cache: pnpm | |
- name: Update graphql.schema | |
run: pnpm --package=@graphql-inspector/cli dlx graphql-inspector introspect $GRAPHQL_API_ENDPOINT --write schema.graphql | |
env: | |
GRAPHQL_API_ENDPOINT: "${{ vars.GRAPHQL_API_ENDPOINT }}" | |
- uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2 | |
id: generate-token | |
with: | |
app_id: ${{ secrets.AUTOMERGE_APP_ID }} | |
private_key: ${{ secrets.AUTOMERGE_APP_PRIVATE_KEY }} | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
branch: update-graphql-schema | |
delete-branch: true | |
title: "Update `graphql.schema`" | |
commit-message: "Update `graphql.schema`" | |
labels: | | |
automated | |
- name: Enable Pull Request Automerge | |
if: steps.cpr.outputs.pull-request-operation == 'created' | |
run: gh pr merge --merge --auto "${{ steps.cpr.outputs.pull-request-number }}" | |
env: | |
GH_TOKEN: ${{ github.token }} |