Skip to content

Commit

Permalink
chore: testing message output for conditional job handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderblue committed May 14, 2024
1 parent 6080082 commit 8645a40
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
25 changes: 11 additions & 14 deletions .github/workflows/graphql-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ on:
# - cron: '5 5 * * 1'

jobs:
downloadSchema:
checkForApiUpdates:
name: Check for API updates
runs-on: ubuntu-latest
steps:
- name: Install Node
Expand Down Expand Up @@ -63,19 +64,19 @@ jobs:
- name: Send report to Slack
id: slack
if: ${{ always() }}
if: ${{ steps.schema-diff.outputs.new_endpoints != '' }}
uses: slackapi/slack-github-action@v1.26
with:
# Uses Slack's Block Kit to build the message
# "New Relic Client Go | NerdGraph API Report",
# https://app.slack.com/block-kit-builder
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "🔎 *NerdGraph API Updates:*"
"text": "🔎 ## New Relic Client Go | NerdGraph API Report"
}
},
{
Expand Down Expand Up @@ -109,16 +110,12 @@ jobs:
# - 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: 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

# - name: Upload latest schema.json
# uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions scripts/schema-diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ module.exports = async ({
const endpointsLatest = schemaLatest.mutationType.fields.map((field) => field.name);
const endpointsDiff = endpointsLatest.filter(x => !endpointsOld.includes(x));

console.log("New Endpoints:", endpointsDiff);
console.log('New Endpoints:', endpointsDiff);

let message = "No NerdGraph API updates since the last check."
let message = 'abc, defg, hijkl, mnop'
if (endpointsDiff.length > 0) {
message = `'${endpointsDiff.join('\n')}'`
}
Expand Down

0 comments on commit 8645a40

Please sign in to comment.