-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Integrate Oz changelog skill into create_release workflow #10832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+162
−13
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
109 changes: 109 additions & 0 deletions
109
.agents/skills/changelog-draft/scripts/convert_to_release_json.py
This file contains hidden or 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,109 @@ | ||
| #!/usr/bin/env python3 | ||
| """Convert changelog-draft.json to the release-pipeline-compatible changelog-release.json. | ||
|
|
||
| Reads the audit artifact produced by the changelog-draft skill and emits the | ||
| flat JSON structure consumed by the create_release workflow (Slack payload | ||
| builder + in-app changelog.json step). | ||
|
|
||
| Usage: | ||
| python3 convert_to_release_json.py --input <changelog-draft.json> --output <changelog-release.json> | ||
|
|
||
| The output schema: | ||
| { | ||
| "newFeatures": ["..."], | ||
| "improvements": ["..."], | ||
| "bugFixes": ["..."], | ||
| "images": ["..."], | ||
| "oz_updates": ["..."] | ||
| } | ||
| """ | ||
|
|
||
| import argparse | ||
| import json | ||
| import sys | ||
|
|
||
| # Map from changelog-draft.json category names to release JSON keys. | ||
| CATEGORY_MAP = { | ||
| "NEW-FEATURE": "newFeatures", | ||
| "IMPROVEMENT": "improvements", | ||
| "BUG-FIX": "bugFixes", | ||
| "OZ": "oz_updates", | ||
| "IMAGE": "images", | ||
| } | ||
|
|
||
| REPO_URL = "https://github.com/warpdotdev/warp" | ||
|
|
||
|
|
||
| def format_entry(entry: dict) -> str: | ||
| """Format a single changelog entry as a text line with a PR link. | ||
|
|
||
| Includes external contributor attribution when applicable. | ||
| """ | ||
| text = entry["text"] | ||
| pr_number = entry["pr_number"] | ||
| link = f"([#{pr_number}]({REPO_URL}/pull/{pr_number}))" | ||
|
|
||
| attribution = "" | ||
| if entry.get("is_external") and entry.get("author"): | ||
| attribution = f" — @{entry['author']} ✨" | ||
|
|
||
| return f"{text} {link}{attribution}" | ||
|
|
||
|
|
||
| def convert(draft: dict) -> dict: | ||
| """Convert a changelog-draft.json dict to changelog-release.json dict.""" | ||
| release: dict[str, list[str]] = { | ||
| "newFeatures": [], | ||
| "improvements": [], | ||
| "bugFixes": [], | ||
| "images": [], | ||
| "oz_updates": [], | ||
| } | ||
|
|
||
| for entry in draft.get("entries", []): | ||
| category = entry.get("category", "") | ||
| release_key = CATEGORY_MAP.get(category) | ||
| if release_key is None: | ||
| continue | ||
|
|
||
| if category == "IMAGE": | ||
| # IMAGE entries store a URL in "text" — pass through directly. | ||
| release["images"].append(entry["text"]) | ||
| else: | ||
| release[release_key].append(format_entry(entry)) | ||
|
|
||
| return release | ||
|
|
||
|
|
||
| def main() -> None: | ||
| parser = argparse.ArgumentParser( | ||
| description="Convert changelog-draft.json to changelog-release.json" | ||
| ) | ||
| parser.add_argument( | ||
| "--input", | ||
| required=True, | ||
| help="Path to changelog-draft.json", | ||
| ) | ||
| parser.add_argument( | ||
| "--output", | ||
| required=True, | ||
| help="Path to write changelog-release.json", | ||
| ) | ||
| args = parser.parse_args() | ||
|
|
||
| with open(args.input) as f: | ||
| draft = json.load(f) | ||
|
|
||
| release = convert(draft) | ||
|
|
||
| with open(args.output, "w") as f: | ||
| json.dump(release, f, indent=2) | ||
| f.write("\n") | ||
|
|
||
| # Summary to stdout for CI logs | ||
| for key, items in release.items(): | ||
| print(f" {key}: {len(items)} entries") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
This file contains hidden or 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 | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -1619,7 +1619,7 @@ jobs: | |||||||
|
|
||||||||
| generate_changelogs: | ||||||||
| name: Generate Changelogs | ||||||||
| if: ${{ needs.prepare_release.outputs.should_publish == 'true' }} | ||||||||
| if: ${{ needs.prepare_release.outputs.should_publish == 'true' && inputs.channel == 'stable' }} | ||||||||
| runs-on: ubuntu-latest | ||||||||
| needs: | ||||||||
| - prepare_release | ||||||||
|
|
@@ -1646,20 +1646,48 @@ jobs: | |||||||
| config_file: ${{ env.CONFIG_FILE }} | ||||||||
| channel: ${{ inputs.channel }} | ||||||||
|
|
||||||||
| - name: Obtain a GitHub App Installation Access Token | ||||||||
| id: github_app_auth | ||||||||
| - name: Generate changelog via Oz | ||||||||
| uses: warpdotdev/oz-agent-action@ce1621abf6a8ed8afdd4e4cc994545ede8fe1c6f # main | ||||||||
| with: | ||||||||
| prompt: | | ||||||||
| Generate a changelog draft for the ${{ inputs.channel }} channel, release tag ${{ needs.prepare_release.outputs.release_tag }}. | ||||||||
|
|
||||||||
| Output directory: ${{ runner.temp }}/changelog-draft | ||||||||
|
|
||||||||
| Follow the workflow in .agents/skills/changelog-draft/SKILL.md exactly. | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| Make sure to produce both output files: changelog-draft.md and changelog-draft.json. | ||||||||
|
|
||||||||
| After writing the output files, print the full contents of changelog-draft.md to stdout so it appears in the workflow log. | ||||||||
|
|
||||||||
| You are running in a GitHub Actions workflow. The repo is checked out at the default branch (HEAD) with full history. Use the release_tag input as the git range endpoint — do NOT check out the release tag. `gh` is authenticated. Do not commit, push, or create PRs. | ||||||||
| warp_api_key: ${{ secrets.WARP_API_KEY }} | ||||||||
| share: team | ||||||||
|
|
||||||||
| - name: Convert draft JSON to release format | ||||||||
| shell: bash | ||||||||
| run: | | ||||||||
| TOKEN="$(npx obtain-github-app-installation-access-token ci ${{ secrets.GH_APP_CREDENTIALS_TOKEN }})" | ||||||||
| echo "::add-mask::$TOKEN" | ||||||||
| echo "token=$TOKEN" >> $GITHUB_OUTPUT | ||||||||
| python3 .agents/skills/changelog-draft/scripts/convert_to_release_json.py \ | ||||||||
| --input "${{ runner.temp }}/changelog-draft/changelog-draft.json" \ | ||||||||
| --output "${{ runner.temp }}/changelog-draft/changelog-release.json" | ||||||||
|
|
||||||||
| - name: Generate changelog | ||||||||
| uses: warpdotdev/generate-changelog@70f534c1e030dafb45046ae57e4aa4d43a2f5c84 # main | ||||||||
| - name: Load release changelog into step output | ||||||||
| id: generate_changelog | ||||||||
| with: | ||||||||
| channel: ${{ inputs.channel }} | ||||||||
| github_auth_token: ${{ steps.github_app_auth.outputs.token }} | ||||||||
| version: ${{ needs.prepare_release.outputs.release_tag }} | ||||||||
| shell: bash | ||||||||
| run: | | ||||||||
| # Read the release-pipeline-compatible JSON produced by the conversion | ||||||||
| # script and expose it as a step output so downstream steps can consume | ||||||||
| # it with the same interface as the old generate-changelog action. | ||||||||
| CHANGELOG_FILE="${{ runner.temp }}/changelog-draft/changelog-release.json" | ||||||||
| if [ ! -f "$CHANGELOG_FILE" ]; then | ||||||||
| echo "::error::changelog-release.json not found at $CHANGELOG_FILE" | ||||||||
| exit 1 | ||||||||
| fi | ||||||||
| # Validate JSON | ||||||||
| jq empty "$CHANGELOG_FILE" | ||||||||
| # Set multiline output | ||||||||
| echo "changelog<<CHANGELOG_EOF" >> $GITHUB_OUTPUT | ||||||||
| cat "$CHANGELOG_FILE" >> $GITHUB_OUTPUT | ||||||||
| echo "CHANGELOG_EOF" >> $GITHUB_OUTPUT | ||||||||
|
|
||||||||
| - name: Build Slack changelog payload | ||||||||
| id: build_slack_payload | ||||||||
|
|
@@ -1745,7 +1773,7 @@ jobs: | |||||||
| NEW_FEATURES=$(echo $CHANGELOG_SECTIONS | jq 'with_entries(select(.key == "New features"))' | jq -r 'to_entries[] | "* \(.value[])"' | awk -v ORS='\n' '1') | ||||||||
| IMPROVEMENTS=$(echo $CHANGELOG_SECTIONS | jq 'with_entries(select(.key == "Improvements"))' | jq -r 'to_entries[] | "* \(.value[])"' | awk -v ORS='\n' '1') | ||||||||
| # Extract the image URL from the list, and use the latest URL even if there are multiple | ||||||||
| IMAGE=$(echo $CHANGELOG | jq -r '.image | if length > 0 then .[-1] else "" end') | ||||||||
| IMAGE=$(echo $CHANGELOG | jq -r '.images | if length > 0 then .[-1] else "" end') | ||||||||
| # Extract Oz updates as a JSON array | ||||||||
| OZ_UPDATES=$(echo $CHANGELOG | jq -c '.oz_updates // []') | ||||||||
| # Tweak the structure of the JSON, add in a top-level date field, and add in the markdown_sections field | ||||||||
|
|
||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previewanddevreleases even though the workflow previously posted/uploaded changelogs for every publishable channel. Remove this guard or add equivalent changelog handling for the other configured channels.