From 89952c5ec61e5e953565a464d4aee49e63223d7f Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 27 Jul 2026 16:18:20 +0000 Subject: [PATCH 1/2] fix: use PR-based approach for monthly activity commit The workflow now creates a branch, pushes an empty commit to it, and opens a PR instead of pushing directly to main. This works around branch protection rules that require changes to go through PRs. Auto-merge is attempted if enabled in repo settings. Co-authored-by: Walter Galvao --- .github/workflows/monthly-activity.yaml | 29 ++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/monthly-activity.yaml b/.github/workflows/monthly-activity.yaml index 321b647..45287cd 100644 --- a/.github/workflows/monthly-activity.yaml +++ b/.github/workflows/monthly-activity.yaml @@ -11,6 +11,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + pull-requests: write steps: - name: Checkout repository uses: actions/checkout@v4 @@ -20,7 +21,29 @@ jobs: git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - - name: Create and push empty commit + - name: Create branch with empty commit and open PR + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - git commit --allow-empty -m "chore: fake activity to GitHub workflows enabled" - git push + BRANCH_NAME="automated/monthly-activity-$(date +%Y%m)" + + # Create and switch to new branch + git checkout -b "$BRANCH_NAME" + + # Create empty commit + git commit --allow-empty -m "chore: fake activity to keep GitHub workflows enabled" + + # Push the branch + git push -u origin "$BRANCH_NAME" + + # Create PR + PR_URL=$(gh pr create \ + --title "chore: monthly activity commit ($(date +%B\ %Y))" \ + --body "Automated monthly activity commit to keep GitHub Actions enabled. This PR was created automatically by the monthly-activity workflow." \ + --base main \ + --head "$BRANCH_NAME") + + echo "Created PR: $PR_URL" + + # Enable auto-merge (will only work if auto-merge is enabled in repo settings) + gh pr merge --auto --squash "$PR_URL" || echo "Auto-merge not available - PR will need manual merge" From 567e54a43005d160eec742c81caf251bd5111eb1 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 27 Jul 2026 16:21:54 +0000 Subject: [PATCH 2/2] fix: use PAT for direct push to bypass branch protection Uses ACTIVITY_PAT secret instead of GITHUB_TOKEN. The PAT owner must be added to the branch protection bypass list for this to work. Co-authored-by: Walter Galvao --- .github/workflows/monthly-activity.yaml | 32 ++++--------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/.github/workflows/monthly-activity.yaml b/.github/workflows/monthly-activity.yaml index 45287cd..2f1874b 100644 --- a/.github/workflows/monthly-activity.yaml +++ b/.github/workflows/monthly-activity.yaml @@ -9,41 +9,19 @@ on: jobs: fake-activity: runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write steps: - name: Checkout repository uses: actions/checkout@v4 + with: + # Use PAT to authenticate - the PAT owner must be in the branch protection bypass list + token: ${{ secrets.ACTIVITY_PAT }} - name: Configure git run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - - name: Create branch with empty commit and open PR - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create and push empty commit run: | - BRANCH_NAME="automated/monthly-activity-$(date +%Y%m)" - - # Create and switch to new branch - git checkout -b "$BRANCH_NAME" - - # Create empty commit git commit --allow-empty -m "chore: fake activity to keep GitHub workflows enabled" - - # Push the branch - git push -u origin "$BRANCH_NAME" - - # Create PR - PR_URL=$(gh pr create \ - --title "chore: monthly activity commit ($(date +%B\ %Y))" \ - --body "Automated monthly activity commit to keep GitHub Actions enabled. This PR was created automatically by the monthly-activity workflow." \ - --base main \ - --head "$BRANCH_NAME") - - echo "Created PR: $PR_URL" - - # Enable auto-merge (will only work if auto-merge is enabled in repo settings) - gh pr merge --auto --squash "$PR_URL" || echo "Auto-merge not available - PR will need manual merge" + git push