Skip to content

Commit

Permalink
ci: Fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
CycleBai committed Jul 29, 2024
1 parent 0413567 commit b657352
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions .github/workflows/auto_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,26 @@ jobs:
- name: Create Pull Request
if: env.branch_exists == 'false'
id: create_pr
run: |
response=$(curl -s -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '{
"title": "Auto PR from ${{ env.branch_name }}",
"body": "This is an automated PR created from ${{ env.branch_name }}",
"head": "${{ env.branch_name }}",
"base": "main"
}' \
https://api.github.com/repos/${{ github.repository }}/pulls)
echo "response=$response" >> $GITHUB_ENV
echo "PR creation response: $response"
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ env.branch_name }}
base: main
title: "Auto PR from ${{ env.branch_name }}"
body: "This is an automated PR created from ${{ env.branch_name }}"
draft: false

- name: Wait for PR creation
if: env.branch_exists == 'false'
run: sleep 30 # 等待 30 秒,确保 PR 被创建
run: sleep 20 # 等待 20 秒,确保 PR 被创建

- name: Get PR number
if: env.branch_exists == 'false'
id: get_pr_number
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pr_number=$(echo "${{ env.response }}" | jq -r .number)
pr_number=$(gh pr list --state open --head ${{ env.branch_name }} --json number -q '.[0].number')
echo "pr_number=$pr_number" >> $GITHUB_ENV
echo "PR number: $pr_number"
Expand Down

0 comments on commit b657352

Please sign in to comment.