-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(automation): [wip] add workflow for diffing the schema
- Loading branch information
1 parent
759467d
commit 1c739e6
Showing
4 changed files
with
227 additions
and
130,094 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
name: NerdGraph Schema Diff | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: [main] | ||
|
||
# schedule: | ||
# - cron: '5 5 * * 1' | ||
|
||
jobs: | ||
downloadSchema: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.21.x | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Check for schema updates | ||
run: ls scripts | ||
|
||
- name: Download artifact | ||
uses: actions/github-script@v6 | ||
# continue-on-error: true | ||
env: | ||
WORKFLOW_FILENAME: graphql-schema.yml | ||
ARTIFACT_NAME: schema | ||
ARTIFACT_FILENAME: schema.zip | ||
UNZIP_DIR: ./ | ||
with: | ||
script: | | ||
const script = require('./scripts/download-previous-artifact.js') | ||
await script({github, context, core}) | ||
- name: Rename schema.json to schema-old.json | ||
run: | | ||
find ./ -type f -name "schema.json" | ||
mv schema.json schema-old.json | ||
- name: Fetch GraphQL Schema | ||
env: | ||
NEW_RELIC_API_KEY: ${{ secrets.NEW_RELIC_API_KEY }} | ||
run: | | ||
go install github.com/newrelic/tutone/cmd/tutone@latest | ||
tutone fetch --refetch | ||
ls | ||
- name: Check for schema updates | ||
uses: actions/github-script@v6 | ||
id: schema-diff | ||
with: | ||
script: | | ||
const script = require('./scripts/schema-diff.js') | ||
await script({core}) | ||
# run: node ./scripts/schema-diff.js | ||
|
||
- name: Check for output from script | ||
run: echo "${{ steps.schema-diff.outputs.new_endpoints }}" | ||
|
||
# - name: Send test failures report to Slack | ||
# id: slack | ||
# if: ${{ always() }} | ||
# uses: slackapi/[email protected] | ||
# with: | ||
# # Uses Slack's Block Kit to build the message | ||
# payload: | | ||
# { | ||
# "text": "New Relic Terraform Provider Test Failures", | ||
# "blocks": [ | ||
# { | ||
# "type": "context", | ||
# "elements": [ | ||
# { | ||
# "type": "plain_text", | ||
# "text": ${{ toJSON(steps.test-failure-report.outputs.UNIT_TEST_FAILURES) }} | ||
# } | ||
# ] | ||
# } | ||
# ] | ||
# } | ||
# env: | ||
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
|
||
# uploadSchema: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Install Node | ||
# uses: actions/setup-node@v4 | ||
# with: | ||
# node-version: 20.x | ||
|
||
# - name: Install Go | ||
# uses: actions/setup-go@v5 | ||
# with: | ||
# go-version: 1.21.x | ||
|
||
# - name: Checkout code | ||
# uses: actions/checkout@v3 | ||
|
||
# - name: Fetch GraphQL Schema | ||
# env: | ||
# NEW_RELIC_API_KEY: ${{ secrets.NEW_RELIC_API_KEY }} | ||
# run: | | ||
# go install github.com/newrelic/tutone/cmd/tutone@latest | ||
# tutone fetch --refetch | ||
# ls | ||
|
||
# # - name: Check for schema updates | ||
# # run: ./scripts/schema-diff.js | ||
|
||
# - name: Upload latest schema.json | ||
# uses: actions/upload-artifact@v4 | ||
# with: | ||
# # Duration after which artifact will expire in days. 0 means using default retention. | ||
# # Minimum 1 day. | ||
# # Maximum 90 days unless changed from the repository settings page. | ||
# retention-days: 90 | ||
# name: schema | ||
# path: schema.json | ||
# if-no-files-found: error | ||
# overwrite: true |
Oops, something went wrong.