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 2629bd2 commit 8b5818f
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/auto_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ jobs:
- name: Create Pull Request
if: env.branch_exists == 'false'
uses: peter-evans/create-pull-request@v6
id: create_pr
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ env.branch_name }}
Expand All @@ -74,23 +75,22 @@ jobs:
body: "This is an automated PR created from ${{ env.branch_name }}"
draft: false # Ensure the PR is not a draft

- name: Verify Pull Request Creation
- name: Wait for PR creation
if: env.branch_exists == 'false'
run: sleep 10 # Wait for 10 seconds to ensure PR creation is processed

- name: Get PR number
if: env.branch_exists == 'false'
id: get_pr_number
run: |
pr_url=$(gh pr list --state open --head ${{ env.branch_name }} --json url -q '.[0].url')
echo "PR URL: $pr_url"
if [ -z "$pr_url" ]; then
echo "PR creation failed."
exit 1
else
echo "PR created successfully: $pr_url"
fi
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"
- name: Append commit to existing PR
env:
GH_TOKEN: ${{ github.token }}
if: env.branch_exists == 'true'
run: |
pr_number=$(gh pr list --state open --head ${{ env.branch_name }} --json number -q '.[0].number')
echo "pr_number=$pr_number" >> $GITHUB_ENV
echo "Appending commit to PR #${{ env.pr_number }}"
gh pr comment ${{ env.pr_number }} --body "New commits have been added to the PR."

0 comments on commit 8b5818f

Please sign in to comment.