Update sync-main.yml

This commit is contained in:
dilanbhalla
2025-04-08 16:22:18 -07:00
committed by GitHub
parent 98338fe6c8
commit 3d57ea9d8c

View File

@@ -29,14 +29,14 @@ jobs:
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -B sync-main-pr origin/sync-main-pr
git checkout -B auto/sync-main-pr origin/auto/sync-main-pr
- name: Sync origin/main
shell: bash
run: |
echo "::group::Sync with main branch"
git pull origin sync-main-pr; exitCode=$?; if [ $exitCode -ne 0 ]; then exitCode=0; fi
git pull origin auto/sync-main-pr; exitCode=$?; if [ $exitCode -ne 0 ]; then exitCode=0; fi
git pull origin main
git push --force origin sync-main-pr
git push --force origin auto/sync-main-pr
echo "::endgroup::"
- name: Sync upstream/codeql-cli/latest
shell: bash
@@ -52,18 +52,15 @@ jobs:
echo "::endgroup::"
- name: Push sync branch
run: |
git push origin sync-main-pr
git push origin auto/sync-main-pr
env:
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
- name: Create or update PR
run: |
if gh pr list --repo microsoft/codeql --head sync-main-pr --base main --json number --jq '.[0].number' > /dev/null; then
echo "PR from sync-main-pr to main already exists. Exiting gracefully."
if gh pr list --repo microsoft/codeql --head auto/sync-main-pr --base main --json number --jq '.[0].number' > /dev/null; then
echo "PR from auto/sync-main-pr to main already exists. Exiting gracefully."
else
gh pr create --repo microsoft/codeql --fill -B main -H sync-main-pr --title 'Sync Main' --body "This PR syncs the latest changes from \`codeql-cli/latest\` into \`main\`."
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\`."
fi
env:
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}