feat: add /prerelease slash command to trigger publish workflow#839
Conversation
Co-Authored-By: AJ Steers <aj@airbyte.io>
…e slash command Co-Authored-By: AJ Steers <aj@airbyte.io>
Original prompt from AJ Steers |
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. Testing This CDK VersionYou can test this version of the CDK using the following: # Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1762681962-add-prerelease-slash-command#egg=airbyte-python-cdk[dev]' --help
# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1762681962-add-prerelease-slash-commandHelpful ResourcesPR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a /prerelease slash command that enables maintainers to trigger prerelease publishes directly from PR comments, streamlining the prerelease workflow by eliminating the need to manually navigate to the Actions tab.
Key Changes:
- New
prerelease-command.ymlworkflow that triggers the publish workflow with sensible defaults - Integration with existing slash command dispatch system
- Updated documentation across help text and PR welcome messages
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/prerelease-command.yml |
New workflow that handles /prerelease command execution and triggers publish workflow with default parameters |
.github/workflows/slash_command_dispatch.yml |
Registers /prerelease command in dispatch list and adds it to help text |
.github/workflows/publish.yml |
Updates description to recommend using /prerelease slash command for prereleases |
.github/pr-welcome-internal.md |
Adds /prerelease to the list of available slash commands for internal contributors |
.github/pr-welcome-community.md |
Adds /prerelease to the list of available slash commands for community contributors |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add explicit permissions block (contents: read, pull-requests: write, issues: write) - Fix --ref to use PR head branch instead of github.ref (main) - Add PR info fetching step to get head branch and repo - Add guard to prevent usage on forks (only works for branches in this repo) - Add guard to prevent usage on issues (PR-only) - Improve race condition handling by filtering workflow runs by branch - Add fallback URL if workflow run not found - Document that hardcoded defaults mirror publish.yml defaults Co-Authored-By: AJ Steers <aj@airbyte.io>
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughAdds a new Changes
Sequence DiagramsequenceDiagram
participant User as PR Author
participant GH as GitHub PR
participant Dispatcher as Slash Command Dispatcher
participant PrereleaseWF as Prerelease Command Workflow
participant PublishWF as Publish Workflow
participant GHApp as GitHub App
User->>GH: Comment `/prerelease`
GH->>Dispatcher: Dispatch slash command
Dispatcher->>PrereleaseWF: workflow_dispatch(pr, comment-id)
PrereleaseWF->>GHApp: Authenticate (GitHub App)
PrereleaseWF->>GH: (optional) Post initial comment with run URL
PrereleaseWF->>PublishWF: Trigger publish.yml on PR head ref (prerelease args)
PublishWF-->>PrereleaseWF: Complete (success/failure)
PrereleaseWF->>GH: Update comment with publish run URL and status
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.github/pr-welcome-community.md(1 hunks).github/pr-welcome-internal.md(1 hunks).github/workflows/prerelease-command.yml(1 hunks).github/workflows/publish.yml(1 hunks).github/workflows/slash_command_dispatch.yml(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-11-20T12:05:50.628Z
Learnt from: ChristoGrab
Repo: airbytehq/airbyte-python-cdk PR: 77
File: .github/workflows/pypi_publish.yml:70-75
Timestamp: 2024-11-20T12:05:50.628Z
Learning: In the file `.github/workflows/pypi_publish.yml`, when setting the `VERSION` variable in a shell script, avoid adding quotes around the variable assignment, as it can include the quotes in the variable's value. This can lead to unintended Docker tags like `airbyte/source-declarative-manifest:'6.7.0dev8'`.
Applied to files:
.github/workflows/publish.yml
🪛 GitHub Check: CodeQL
.github/workflows/prerelease-command.yml
[warning] 17-90: Workflow does not contain permissions
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{}}
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: MyPy Check
- GitHub Check: Pytest (Fast)
- GitHub Check: preview_docs
- GitHub Check: SDM Docker Image Build
- GitHub Check: Manifest Server Docker Image Build
- GitHub Check: Analyze (python)
🔇 Additional comments (5)
.github/pr-welcome-community.md (1)
30-30: LGTM!Clear and consistent documentation that aligns well with the other slash commands.
.github/pr-welcome-internal.md (1)
29-29: LGTM!Consistent documentation with the community version. Both welcome messages now accurately reflect the new slash command.
.github/workflows/slash_command_dispatch.yml (1)
38-38: LGTM!Command properly registered in both the dispatch list and help text. Help text is consistent with the welcome documentation.
Also applies to: 67-67
.github/workflows/publish.yml (1)
23-26: LGTM!Enhanced description clearly documents the three options for triggering: via
/prereleaseslash command, manual trigger with blank version, or with explicit version override. This aligns well with the new workflow..github/workflows/prerelease-command.yml (1)
52-52: Verify thatgithub.refis correct when triggered via the slash command.When this workflow is invoked from a PR slash command dispatch,
github.refwill reflect the context in which the dispatch step runs. Can you confirm this is the desired ref (i.e., the branch or ref of the PR where the command was issued)?If the dispatch happens from a PR comment, we might need to explicitly pass the PR's head ref instead of relying on
github.ref.You can verify this by checking what ref value is used when the workflow runs from a PR comment trigger. Does it use the PR's branch, or the repo's default branch?
Also applies to: 52-52
Replace gh workflow run with the-actions-org/workflow-dispatch@v4 marketplace action. This provides cleaner workflow URL output and eliminates the need for sleep + query logic. Benefits: - Direct workflow-url output from the action - No race conditions from querying recent runs - Cleaner, more maintainable code - Purpose-built for workflow_dispatch events Co-Authored-By: AJ Steers <aj@airbyte.io>
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/workflows/prerelease-command.yml (1)
98-108: Consider adding explicitsuccess()condition to the success comment.The success comment (lines 98-107) currently only checks for
comment-id, but best practice would also verify that all prior steps succeeded. Currently, if the publish workflow trigger fails, the job fails overall so the success comment won't post—but adding an explicitsuccess()condition would make the intent crystal clear and protect against edge cases.- name: Append success comment - if: github.event.inputs.comment-id + if: success() && github.event.inputs.comment-id uses: peter-evans/create-or-update-comment@v4Wdyt—does this feel like a good safeguard to add?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/prerelease-command.yml(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-11-10T03:44:36.017Z
Learnt from: aaronsteers
Repo: airbytehq/airbyte-python-cdk PR: 2
File: .github/workflows/pypi_publish.yml:0-0
Timestamp: 2024-11-10T03:44:36.017Z
Learning: In GitHub Actions workflows, when a job includes an `if` condition to execute only when `startsWith(github.ref, 'refs/tags/')`, it's acceptable to have broader `on: push` triggers because the job will skip execution unless a tag is pushed.
Applied to files:
.github/workflows/prerelease-command.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Pytest (Fast)
🔇 Additional comments (4)
.github/workflows/prerelease-command.yml (4)
1-19: Permissions and inputs look solid.The minimal permission set (read contents, write PRs/issues) aligns well with the operations performed, and optional inputs provide flexibility without sacrificing security.
26-43: GitHub App auth and guards are well-structured.Good separation of concerns: token creation, run URL for the prerelease job itself, and a clear guard to prevent misuse on non-PR contexts.
45-63: PR validation logic is solid.The fork detection is important and correctly implemented. The
gh apicall will fail clearly if there are any issues (network, permissions, PR not found), which is acceptable for a workflow.
81-116: Marketplace action integration and comment flow look good.The
the-actions-org/workflow-dispatch@v4action withwait-for-completion: trueis a solid upgrade from the previousgh workflow runapproach—it eliminates race conditions and provides reliableworkflow-urloutput. The hardcoded prerelease defaults match the PR objectives, and failure handling with thefailure()guard is in place.One small note: the initial comment (lines 65-79) posts before the workflow actually runs, which is fine for UX (gives users immediate feedback), but it references "Check job output" which then gets enriched in the success comment with the actual publish workflow URL. This flow makes sense.
feat: add /prerelease slash command to trigger publish workflow
Summary
This PR adds a new
/prereleaseslash command that allows maintainers to trigger the publish workflow with default arguments directly from a PR comment. This simplifies the process of creating prereleases during development.Changes:
.github/workflows/prerelease-command.ymlthat triggers the publish workflow with default arguments (publish to PyPI, DockerHub, and Manifest Server, but don't update Connector Builder)slash_command_dispatch.ymlto recognize and dispatch the/prereleasecommand/prereleaseto both internal and community PR welcome messages/prereleaseto the slash command help textReview & Testing Checklist for Human
This is a yellow risk PR - the workflow logic is new and untested in production.
/prereleasecommand end-to-end - Comment/prereleaseon a test PR and verify it triggers the publish workflow correctly--ref ${{ github.ref }}which may need adjustment)Test Plan
/prereleaseon the PRNotes
gh workflow runto trigger publish.yml, which requires the GitHub App token for authentication--refparameter may need adjustment depending on how GitHub Actions resolves refs when triggered from PR commentsRequested by: AJ Steers (Aaron ("AJ") Steers (@aaronsteers))
Devin Session: https://app.devin.ai/sessions/b5ff1b85488c40b691bdda024f919b91
Summary by CodeRabbit
New Features
/prereleaseslash command for PR comments to trigger a prerelease publish with default arguments.Chores