Skip to content

Add scripts/new_resources to resolve upstream new resources to their products - #3932

Open
pose wants to merge 1 commit into
masterfrom
pose/chores/new-resources-script
Open

Add scripts/new_resources to resolve upstream new resources to their products#3932
pose wants to merge 1 commit into
masterfrom
pose/chores/new-resources-script

Conversation

@pose

@pose pose commented Aug 21, 2026

Copy link
Copy Markdown
Member

Walks a terraform-provider-google-beta release tag to the magic-modules product each new resource belongs to, printing the product name in snake case. Covered by golden tests that replay recorded git and gh calls, so they need no network.

cd scripts && python3 -m new_resources v7.45.0

Also adds gh to the root mise.toml (the only dependency the repo toolchain was missing; python was already there) and ignores __pycache__.

…products

Walks a terraform-provider-google-beta release tag to the magic-modules
product each new resource belongs to, printing the product name in snake
case. Covered by golden tests that replay recorded git and gh calls.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@pose
pose requested a review from a team August 21, 2026 11:56
@pose pose self-assigned this Aug 21, 2026
@pose pose added this to the 0.140 milestone Aug 21, 2026

@unblocked unblocked Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found.

About Unblocked

Unblocked has been set up to automatically review your team's pull requests to identify genuine bugs and issues.

📖 Documentation — Learn more in our docs.

💬 Ask questions — Mention @unblocked to request a review or summary, or ask follow-up questions.

👍 Give feedback — React to comments with 👍 or 👎 to help us improve.

⚙️ Customize — Adjust settings in your preferences.

if sha is None:
sha = gh_json(f"repos/{TPG_REPO}/commits/{ref}", "{sha}")["sha"]

tags = run("git", "-C", upstream, "tag", "--points-at", sha).split() if upstream else []

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When upstream is not None but rev-parse failed at line 90 (ref not fetched locally), sha gets resolved via the GitHub API at line 94. Line 96 then unconditionally runs git tag --points-at sha against the local upstream repo. Since that sha isn't present locally, the git command will fail and run() raises an uncaught RuntimeError, crashing the tool.

Compare with changelog() (line 117-121) which correctly wraps its local git call in try/except for the same scenario.

Suggested change
tags = run("git", "-C", upstream, "tag", "--points-at", sha).split() if upstream else []
try:
tags = run("git", "-C", upstream, "tag", "--points-at", sha).split() if upstream else []
except RuntimeError:
tags = []

@github-actions

Copy link
Copy Markdown
Contributor

Does the PR have any schema changes?

Generated by schema-tools v0.8.1.

Looking good! No breaking changes found.
No new resources/functions/types.

Maintainer note: consult the runbook for dealing with any breaking changes.

@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.51%. Comparing base (aeda066) to head (4fe19a2).

Additional details and impacted files
@@          Coverage Diff           @@
##           master   #3932   +/-   ##
======================================
  Coverage    0.51%   0.51%           
======================================
  Files           8       8           
  Lines        1947    1947           
======================================
  Hits           10      10           
  Misses       1937    1937           

☔ 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.

@guineveresaenger guineveresaenger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems useful! Discoverability might be an issue, is there anywhere else we have where we could point to this script?

LGTM.

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