mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 14:57:59 -05:00
Add job to update PR description with docker run command (#4550)
Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
46
.github/workflows/ghcr-build.yml
vendored
46
.github/workflows/ghcr-build.yml
vendored
@@ -399,3 +399,49 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "Some runtime tests failed or were cancelled"
|
echo "Some runtime tests failed or were cancelled"
|
||||||
exit 1
|
exit 1
|
||||||
|
update_pr_description:
|
||||||
|
name: Update PR Description
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
needs: [ghcr_build_runtime]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Get short SHA
|
||||||
|
id: short_sha
|
||||||
|
run: echo "SHORT_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Update PR Description
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
SHORT_SHA: ${{ steps.short_sha.outputs.SHORT_SHA }}
|
||||||
|
run: |
|
||||||
|
echo "updating PR description"
|
||||||
|
DOCKER_RUN_COMMAND="docker run -it --rm \
|
||||||
|
-p 3000:3000 \
|
||||||
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
|
--add-host host.docker.internal:host-gateway \
|
||||||
|
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=ghcr.io/all-hands-ai/runtime:$SHORT_SHA-nikolaik \
|
||||||
|
--name openhands-app-$SHORT_SHA \
|
||||||
|
ghcr.io/all-hands-ai/runtime:$SHORT_SHA"
|
||||||
|
|
||||||
|
PR_BODY=$(gh pr view $PR_NUMBER --json body --jq .body)
|
||||||
|
|
||||||
|
if echo "$PR_BODY" | grep -q "To run this PR locally, use the following command:"; then
|
||||||
|
UPDATED_PR_BODY=$(echo "${PR_BODY}" | sed -E "s|docker run -it --rm.*|$DOCKER_RUN_COMMAND|")
|
||||||
|
else
|
||||||
|
UPDATED_PR_BODY="${PR_BODY}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
To run this PR locally, use the following command:
|
||||||
|
\`\`\`
|
||||||
|
$DOCKER_RUN_COMMAND
|
||||||
|
\`\`\`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "updated body: $UPDATED_PR_BODY"
|
||||||
|
gh pr edit $PR_NUMBER --body "$UPDATED_PR_BODY"
|
||||||
|
|||||||
Reference in New Issue
Block a user