Skip to content

Commit 17446aa

Browse files
authored
Merge pull request #71 from itsmostafa/fix/workflow-use-pr-for-tracking
fix(workflow): use PR with auto-merge for tracking updates
2 parents eb040a1 + 6aa78a1 commit 17446aa

1 file changed

Lines changed: 28 additions & 3 deletions

File tree

.github/workflows/weekly-aws-doc-check.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515
permissions:
1616
contents: write
1717
issues: write
18+
pull-requests: write
1819

1920
jobs:
2021
check-updates:
@@ -43,13 +44,37 @@ jobs:
4344
id: check
4445
run: python scripts/check-aws-updates.py
4546

46-
- name: Commit tracking updates
47+
- name: Commit tracking updates via PR
48+
env:
49+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4750
run: |
4851
git config --local user.email "github-actions[bot]@users.noreply.github.com"
4952
git config --local user.name "github-actions[bot]"
5053
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"
5378
5479
- name: Create GitHub issues for updates
5580
if: steps.check.outputs.updates_found == 'true'

0 commit comments

Comments
 (0)