From bd50ef7a7efc5a2881bf79e9d805fc6be9d50405 Mon Sep 17 00:00:00 2001 From: "THINKPAD_P14S\\rongf" Date: Thu, 3 Sep 2026 19:05:14 -0400 Subject: [PATCH] fix(workflow): push to branch instead of creating PR GitHub account does not permit Actions to create PRs. Push to a fixed branch 'chore/traffic-refresh' instead, and let the user manually create the PR from the compare page. --- .github/workflows/refresh-traffic.yml | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/.github/workflows/refresh-traffic.yml b/.github/workflows/refresh-traffic.yml index 7d6e72f..18800cf 100644 --- a/.github/workflows/refresh-traffic.yml +++ b/.github/workflows/refresh-traffic.yml @@ -108,35 +108,26 @@ jobs: New-Item -ItemType Directory -Force -Path $dir | Out-Null $snap | ConvertTo-Json -Depth 10 | Set-Content -Encoding UTF8 (Join-Path $dir "_traffic.json") - - name: Create branch, commit, push, and open PR + - name: Create branch, commit, and push shell: bash - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | set -euo pipefail if git diff --quiet data/_traffic.json; then - echo "No changes - skipping." + echo "No changes to data/_traffic.json - nothing to do." exit 0 fi - BRANCH="chore/traffic-$(date -u +%Y%m%d-%H%M%S)" + BRANCH="chore/traffic-refresh" git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" + + # Delete old branch if exists, then create fresh + git push origin --delete "$BRANCH" 2>/dev/null || true git checkout -b "$BRANCH" git add data/_traffic.json git commit -m "chore: refresh traffic snapshot $(date -u +%Y-%m-%d)" git push origin "$BRANCH" - EXISTING_PR=$(gh pr list --state open --search "refresh traffic snapshot in:title" --json number 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print(d[0][\"number\"] if d else \"\")" || true) - if [[ -n "$EXISTING_PR" ]]; then - gh pr close "$EXISTING_PR" --comment "Superseded by new refresh." || true - fi - - gh pr create \ - --title "chore: refresh traffic snapshot $(date -u +%Y-%m-%d)" \ - --body "Auto-generated by refresh-traffic workflow. Updates data/_traffic.json with latest GitHub Traffic and NuGet download stats." \ - --base main \ - --head "$BRANCH" - - echo "PR opened from branch $BRANCH" + echo "Pushed to branch $BRANCH - create PR at:" + echo "https://github.com/memoryfraction/Quant.Infra.Net/compare/main...$BRANCH?expand=1"