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 f90448f commit d92c04c
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/auto_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,30 @@ jobs:
- name: Create Pull Request
if: env.branch_exists == 'false'
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v6
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 # Ensure the PR is not a draft

- name: Get PR number
if: env.branch_exists == 'true'
id: get_pr_number
- name: Verify Pull Request Creation
if: env.branch_exists == 'false'
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 "PR number: $pr_number"
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
- name: Append commit to existing PR
if: env.branch_exists == 'true'
run: |
echo "Appending commit to PR #${{ env.pr_number }}"
pr_number=$(gh pr list --state open --head ${{ env.branch_name }} --json number -q '.[0].number')
echo "pr_number=$pr_number" >> $GITHUB_ENV
gh pr comment ${{ env.pr_number }} --body "New commits have been added to the PR."

0 comments on commit d92c04c

Please sign in to comment.