File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -66,12 +66,18 @@ jobs:
6666 git push origin auto/sync-main-pr
6767 env :
6868 GH_TOKEN : ${{ secrets.WORKFLOW_TOKEN }}
69- - name : Create or update PR
69+ - name : Create PR if it doesn't exist
70+ shell : bash
7071 run : |
71- if gh pr list --repo microsoft/codeql --head auto/sync-main-pr --base main --json number --jq '.[0].number' > /dev/null; then
72- echo "PR from auto/sync-main-pr to main already exists. Exiting gracefully."
72+ pr_number=$(gh pr list --repo microsoft/codeql --head auto/sync-main-pr --base main --json number --jq '.[0].number')
73+ if [ -n "$pr_number" ]; then
74+ echo "PR from auto/sync-main-pr to main already exists (PR #$pr_number). Exiting gracefully."
7375 else
74- gh pr create --repo microsoft/codeql --fill -B main -H auto/sync-main-pr --label 'autogenerated' --title 'Sync Main (autogenerated)' --body "This PR syncs the latest changes from \`codeql-cli/latest\` into \`main\`."
76+ echo "PR does not exist. Creating one..."
77+ gh pr create --repo microsoft/codeql --fill -B main -H auto/sync-main-pr \
78+ --label 'autogenerated' \
79+ --title 'Sync Main (autogenerated)' \
80+ --body "This PR syncs the latest changes from \`codeql-cli/latest\` into \`main\`."
7581 fi
7682 env :
77- GH_TOKEN : ${{ secrets.WORKFLOW_TOKEN }}
83+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments