-
Notifications
You must be signed in to change notification settings - Fork 131
feat: Add .pr/ directory convention and auto-cleanup workflow #1764
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
Conversation
Adds a GitHub Actions workflow that: 1. Auto-removes .pr/ directory when a reviewer approves (non-fork PRs) 2. Blocks merge if .pr/ directory still exists (catches fork PRs) This establishes a convention for PR-specific artifacts (design docs, analysis notes) that should not be merged to main. Closes #1763 Co-authored-by: openhands <[email protected]>
- Add workflow_dispatch trigger for manual testing - Add .pr/test-artifact.md to verify blocking behavior Co-authored-by: openhands <[email protected]>
Co-authored-by: openhands <[email protected]>
all-hands-bot
left a comment
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.
Found several issues that should be addressed before merging. Most importantly: missing concurrency control and the test artifact will block merge until approval.
Co-authored-by: OpenHands Bot <[email protected]>
Co-authored-by: OpenHands Bot <[email protected]>
Document the .pr/ directory convention for storing PR-specific design docs and analysis notes that should not be merged to main. Co-authored-by: openhands <[email protected]>
Co-authored-by: openhands <[email protected]>
|
Just realized this will mark every commit with failing check just because we have .pr and that isn't nice. Looking into merge queue or just adding notation as warning instead... |
- Rename job to check-pr-artifacts - Emit warning instead of error when .pr/ exists - Remove exit 1 so checks pass (green) during development - Trust auto-cleanup on approval to remove .pr/ before merge Co-authored-by: openhands <[email protected]>
- Posts a comment to the PR conversation when .pr/ exists - Uses a hidden marker to ensure only ONE comment is ever created - Subsequent runs skip if comment already exists - Added pull-requests: write permission for commenting Co-authored-by: openhands <[email protected]>
|
✅ PR Artifacts Cleaned Up The |
- Add 'How It Works' section explaining the 3-step flow - Clarify that checks pass (green) during development - Remove reference to blocking check Co-authored-by: openhands <[email protected]>
922a71b to
91cc45b
Compare
all-hands-bot
left a comment
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.
Found several critical inconsistencies between the PR description and actual implementation. The workflow does not block merges as claimed.
- After auto-cleanup, update the notice comment to show cleanup completed - Change icon from 📁 to ✅ and update message - Added pull-requests: write permission to cleanup job Co-authored-by: openhands <[email protected]>
Co-authored-by: OpenHands Bot <[email protected]>
Co-authored-by: OpenHands Bot <[email protected]>
Co-authored-by: OpenHands Bot <[email protected]>
Co-authored-by: OpenHands Bot <[email protected]>
Co-authored-by: openhands <[email protected]>
|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like Feel free to include any additional details that might help me get this PR into a better state. You can manage your notification settings |
|
@OpenHands -- looks like maybe we have bug in our GitHub workflow... Lets fix the workflow itself and test again with another approval rather than resolving the issue manually. Run if [ -d ".pr" ]; then Error: Failed to push cleanup commit. Check branch protection rules. |
|
I'm on it! jpshackelford can track my progress at all-hands.dev |
The workflow was checking out the PR head SHA which puts Git in a detached HEAD state. This caused 'git push' to fail with: fatal: You are not currently on a branch. Changed to checkout the branch ref instead, which allows normal git push operations. Co-authored-by: openhands <[email protected]>
SummaryI fixed the bug in the PR artifacts workflow that was causing the push to fail with "fatal: You are not currently on a branch." Root CauseThe workflow was checking out the PR head SHA ( FixChanged the checkout to use the branch ref instead ( - ref: ${{ github.event.pull_request.head.sha }}
+ ref: ${{ github.event.pull_request.head.ref }}This ensures Git is on the actual branch, allowing normal Checklist
The PR is now ready for another approval to test the fix. |
Retest the approval flow automation
Commits made with GITHUB_TOKEN don't trigger subsequent workflow runs (to prevent infinite loops). This caused the PR checks UI to get stuck showing only the Vercel check after the automated cleanup commit. Switch to ALLHANDS_BOT_GITHUB_PAT (already used in todo-management.yml) so that the cleanup commit properly triggers pre-commit, tests, and other CI workflows. Co-authored-by: openhands <[email protected]>
Since the PR is already approved when cleanup runs, there's no need to re-run CI checks. Using [skip ci] in the commit message: 1. Skips all GitHub Actions workflows for the cleanup commit 2. Avoids the 'stuck checks' UI issue (no pending checks to wait for) 3. Doesn't require a PAT (simpler, more secure) 4. Is the standard convention supported by GitHub Actions Co-authored-by: openhands <[email protected]>
The Vercel GitHub App creates check suites for this repo even though there's nothing to deploy. These checks get stuck in 'queued' forever. With [skip ci], GitHub Actions are skipped but Vercel still creates its stuck check, which blocks merging. Using the PAT triggers real CI workflows that complete successfully, which satisfies branch protection requirements regardless of Vercel. Note: The Vercel integration should be reconfigured at the org level to exclude this repo, but that's outside the scope of this workflow. Co-authored-by: openhands <[email protected]>
Adding back the test artifact so the workflow can be properly tested when the PR receives another approval. Co-authored-by: openhands <[email protected]>
We need to test automation again.
enyst
left a comment
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.
I love this!
I suggested to add temporary scripts to it, but it's not a big deal if you feel there are concerns with it. It's because quite many times, I've done something like
"pick x example that is closest to the PR fix, modify a bit to show our fix, then run it, let's see"
That made edits into the examples files themselves, that were not meant for merge.
Maybe instead this allows something like "make a script in .pr like x example that is closest... etc"
Co-authored-by: Engel Nyst <[email protected]>
Co-authored-by: Engel Nyst <[email protected]>
Summary
Adds a convention and automation for PR-specific artifacts (design docs, analysis notes, etc.) that should not be merged to main.
Closes #1763
Changes
GitHub Actions workflow (
.github/workflows/pr-artifacts.yml):.pr/directory is detected.pr/directory when a reviewer approves (non-fork PRs)AGENTS.md documentation for the
.pr/directory conventionConvention
Use a
.pr/directory at the repository root for PR-specific artifacts:How It Works
.pr/.pr/directory auto-removed via commit.pr/artifacts in mainFork PR Handling
.pr/Benefits
Agent Server images for this PR
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
eclipse-temurin:17-jdknikolaik/python-nodejs:python3.12-nodejs22golang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:1cac8fc-pythonRun
All tags pushed for this build
About Multi-Architecture Support
1cac8fc-python) is a multi-arch manifest supporting both amd64 and arm641cac8fc-python-amd64) are also available if needed