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:
66
66
git push origin auto/sync-main-pr
67
67
env :
68
68
GH_TOKEN : ${{ secrets.WORKFLOW_TOKEN }}
69
- - name : Create or update PR
69
+ - name : Create PR if it doesn't exist
70
+ shell : bash
70
71
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."
73
75
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\`."
75
81
fi
76
82
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