|
15 | 15 | permissions: |
16 | 16 | contents: write |
17 | 17 | issues: write |
| 18 | + pull-requests: write |
18 | 19 |
|
19 | 20 | jobs: |
20 | 21 | check-updates: |
@@ -43,13 +44,37 @@ jobs: |
43 | 44 | id: check |
44 | 45 | run: python scripts/check-aws-updates.py |
45 | 46 |
|
46 | | - - name: Commit tracking updates |
| 47 | + - name: Commit tracking updates via PR |
| 48 | + env: |
| 49 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
47 | 50 | run: | |
48 | 51 | git config --local user.email "github-actions[bot]@users.noreply.github.com" |
49 | 52 | git config --local user.name "github-actions[bot]" |
50 | 53 | git add tracking/ |
51 | | - git diff --staged --quiet || git commit -m "chore: update tracking data" |
52 | | - git push |
| 54 | +
|
| 55 | + # Check if there are changes to commit |
| 56 | + if git diff --staged --quiet; then |
| 57 | + echo "No tracking changes to commit" |
| 58 | + exit 0 |
| 59 | + fi |
| 60 | +
|
| 61 | + # Create a unique branch for the tracking update |
| 62 | + BRANCH_NAME="chore/update-tracking-$(date +%Y%m%d-%H%M%S)" |
| 63 | + git checkout -b "$BRANCH_NAME" |
| 64 | + git commit -m "chore: update tracking data" |
| 65 | + git push -u origin "$BRANCH_NAME" |
| 66 | +
|
| 67 | + # Create a PR and auto-merge it |
| 68 | + PR_URL=$(gh pr create \ |
| 69 | + --title "chore: update AWS doc check tracking data" \ |
| 70 | + --body "Automated update of tracking data from weekly AWS documentation check." \ |
| 71 | + --base main \ |
| 72 | + --head "$BRANCH_NAME") |
| 73 | +
|
| 74 | + echo "Created PR: $PR_URL" |
| 75 | +
|
| 76 | + # Enable auto-merge if the repo allows it |
| 77 | + gh pr merge "$PR_URL" --auto --squash || echo "Auto-merge not enabled or not allowed" |
53 | 78 |
|
54 | 79 | - name: Create GitHub issues for updates |
55 | 80 | if: steps.check.outputs.updates_found == 'true' |
|
0 commit comments