Skip to content

Automate browser based workflows with AI

fix sync PR name (#2640)

LawyZhengcd0b5e25f7b6
diff --git a/.github/workflows/sync-skyvern-cloud.yml b/.github/workflows/sync-skyvern-cloud.yml
index 9561391b3..9ed4aefa5 100644
--- a/.github/workflows/sync-skyvern-cloud.yml
+++ b/.github/workflows/sync-skyvern-cloud.yml
@@ -1,27 +1,48 @@
name: Sync to skyvern-cloud
on:
- push:
+ pull_request:
+ types: [closed]
branches:
- main
workflow_dispatch:
+ inputs:
+ pr_number:
+ description: 'PR number to sync'
+ required: true
+ type: string
jobs:
sync:
runs-on: ubuntu-latest
+ if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout Repository
uses: actions/checkout@master
- name: Fetch PR details
id: pr_details
run: |
- PR_NUMBER=$(gh pr list --state merged --base main --limit 1 --json number --jq .[0].number)
+ if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
+ PR_NUMBER=${{ inputs.pr_number }}
+ PR_INFO=$(gh pr view $PR_NUMBER --json number,headRefName,body,title,url,author)
+ BRANCH_NAME=$(echo "$PR_INFO" | jq -r .headRefName)
+ PR_BODY=$(echo "$PR_INFO" | jq -r .body)
+ PR_TITLE=$(echo "$PR_INFO" | jq -r .title)
+ PR_URL=$(echo "$PR_INFO" | jq -r .url)
+ PR_AUTHOR=$(echo "$PR_INFO" | jq -r .author.login)
+ else
+ PR_NUMBER=${{ github.event.pull_request.number }}
+ BRANCH_NAME=${{ github.event.pull_request.head.ref }}
+ PR_BODY=${{ github.event.pull_request.body }}
+ PR_TITLE=${{ github.event.pull_request.title }}
+ PR_URL=${{ github.event.pull_request.html_url }}
+ PR_AUTHOR=${{ github.event.pull_request.user.login }}
+ fi
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT
- BRANCH_NAME=$(gh pr view $PR_NUMBER --json headRefName --jq .headRefName)
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
- PR_BODY=$(gh pr view $PR_NUMBER --json body --jq .body)
PR_BODY_ESCAPED=$(echo "$PR_BODY" | jq -aRs .)
echo "PR_BODY=$PR_BODY_ESCAPED" >> $GITHUB_OUTPUT
- PR_TITLE=$(gh pr view $PR_NUMBER --json title --jq .title)
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_OUTPUT
+ echo "PR_URL=$PR_URL" >> $GITHUB_OUTPUT
+ echo "PR_AUTHOR=$PR_AUTHOR" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run GitHub File Sync
@@ -30,6 +51,9 @@ jobs:
GH_PAT: ${{ secrets.SKYVERN_CLOUD_GH_PAT }}
GIT_EMAIL: [email protected]
GIT_USERNAME: Shuchang Zheng
+ PR_LABELS: |
+ sync
+ ${{steps.pr_details.outputs.PR_AUTHOR }}
BRANCH_NAME: repo-sync/${{ steps.pr_details.outputs.BRANCH_NAME }}
- PR_BODY: ${{ steps.pr_details.outputs.PR_BODY }}
+ PR_BODY: "PR: ${{ steps.pr_details.outputs.PR_URL }}\nAuthor: @${{ steps.pr_details.outputs.PR_AUTHOR }}\n\n${{ steps.pr_details.outputs.PR_BODY }}"
PR_TITLE: ${{ steps.pr_details.outputs.PR_TITLE }}