Skip to content

fix(automation): rebuild NerdGraph API detector workflow - #1422

Open
pranav-new-relic wants to merge 3 commits into
mainfrom
fix/nerdgraph-api-detector-workflow
Open

fix(automation): rebuild NerdGraph API detector workflow#1422
pranav-new-relic wants to merge 3 commits into
mainfrom
fix/nerdgraph-api-detector-workflow

Conversation

@pranav-new-relic

Copy link
Copy Markdown
Member

Summary

The scheduled graphql-schema.yml workflow has been failing for some time and (silently) skipping its code-generation job. This PR replaces it with a renamed, refreshed pair of workflows that fix all three issues at once and run under the bot's identity going forward.

What was broken

# Bug Where Effect
1 Reusable-workflow ref points at a deleted branch: generate.yml@feat/automated-codegen graphql-schema.yml:165 Workflow fails to parse — the "Invalid workflow file" annotation seen on every recent run.
2 Typo in the gating condition: heroHention instead of heroMention graphql-schema.yml:163 The generate-code job has been silently skipped on every run because the condition compared a non-existent output to ''.
3 Scheduled runs are attributed to whoever last pushed the workflow file (currently sanderblue), not the bot schedule: trigger "Actor" of schedule events is hard-set by GitHub; no YAML config can override it.

What this PR does

  • Renames graphql-schema.ymlnerdgraph-api-detector.yml and creates a sibling nerdgraph-api-detector-scheduler.yml. The new file paths give us a fresh workflow entry in the Actions UI (clean run history).
  • Fixes the broken referencegenerate.yml@feat/automated-codegengenerate.yml@main.
  • Fixes the typoheroHentionheroMention.
  • Splits the schedule out — the cron now lives in nerdgraph-api-detector-scheduler.yml, whose only job is gh workflow run nerdgraph-api-detector.yml using secrets.DEV_TOOLKIT_TOKEN. Because workflow_dispatch runs are attributed to the dispatching token's owner, the actual schema-diff work always shows up under nr-developer-toolkit — the same pattern that makes the release workflow's changelog commits attributed to the bot.
  • Rewrites every step name and adds inline comments so the pipeline is readable end-to-end without prior context (intended for newcomers to the repo).

Why two files instead of one

For schedule triggers GitHub forces the run actor to "the user that last pushed the workflow file." The only reliable way to attribute scheduled runs to the bot is to keep the cron in a tiny dispatcher whose only job is an authenticated API call to dispatch the real workflow. The release workflow gets bot attribution for free because it's workflow_dispatch-only — we apply the same pattern here.

Prereqs

  • secrets.DEV_TOOLKIT_TOKEN already exists in the repo (used by generate.yml for peter-evans/create-pull-request). It needs actions: write on this repo to dispatch workflows; if it can already create PRs, it almost certainly can dispatch.

Test plan

  • After merge, manually invoke 🔍 NerdGraph API Detector via "Run workflow" once to confirm it parses and the schema diff path still works.
  • Wait for the next scheduled tick (08:00 / 12:00 / 16:00 UTC, Mon–Fri) and confirm two runs appear: a small "Scheduler" run, and a "🔍 NerdGraph API Detector" run whose Actor is nr-developer-toolkit.
  • When new APIs are next added to NerdGraph, verify the 🛠️ Generate Go bindings for new APIs job actually runs and generate.yml opens the expected draft PR.

🤖 Generated with Claude Code

The scheduled `graphql-schema.yml` workflow has been failing since the
`feat/automated-codegen` branch it referenced was deleted, and a silent
typo (`heroHention`) was preventing the code-generation job from running
even when the diff turned up new APIs.

Replace the file with a renamed pair so the new flow appears as a fresh
workflow in the Actions UI:

- `nerdgraph-api-detector.yml` does the actual schema diff and Slack
  reporting, and now references `generate.yml@main`. The typo is fixed.
  Trigger is `workflow_dispatch`-only.
- `nerdgraph-api-detector-scheduler.yml` owns the cron and dispatches
  the detector via `gh workflow run` using `secrets.DEV_TOOLKIT_TOKEN`.
  Because `workflow_dispatch` runs are attributed to the dispatching
  token's owner, scheduled runs now show as `nr-developer-toolkit`
  instead of whichever human last touched the workflow file.

Step names and inline comments were reworked to make the pipeline
self-explanatory for newcomers.
@codecov-commenter

codecov-commenter commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 33.43%. Comparing base (df75c66) to head (db0688f).
⚠️ Report is 20 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1422      +/-   ##
==========================================
+ Coverage   32.29%   33.43%   +1.14%     
==========================================
  Files         146      148       +2     
  Lines        6766     6909     +143     
==========================================
+ Hits         2185     2310     +125     
- Misses       4375     4384       +9     
- Partials      206      215       +9     
Flag Coverage Δ
unit 33.43% <ø> (+1.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Drop the emoji-heavy step names introduced in the previous commit and use
neutral, descriptive titles consistent with the rest of the repo's
workflows. Comments are kept (still useful for newcomers) but rewritten in
a more conventional tone.
The detector's responsibility is now strictly to report what changed in
NerdGraph since the previous run. Drop the `generate-go-bindings` job and
the four job outputs (heroMention/tutoneConfig/newMutations/packages) that
existed only to feed it. The reusable `.github/workflows/generate.yml` is
left in place since it is invoked from elsewhere; only the call site is
removed here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants