Skip to content

Commit 658df97

Browse files
Update main.yml
1 parent e040252 commit 658df97

File tree

1 file changed

+12
-36
lines changed

1 file changed

+12
-36
lines changed

.github/workflows/main.yml

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ permissions:
55

66
on:
77
schedule:
8+
# Runs at 00:00 every day
89
- cron: '0 * * * *'
10+
# Allows you to run this workflow manually from the Actions tab
911
workflow_dispatch:
1012

1113
jobs:
@@ -14,44 +16,18 @@ jobs:
1416
steps:
1517
- name: Checkout target branch
1618
uses: actions/checkout@v3
17-
with:
18-
# We need full history to merge properly
19-
fetch-depth: 0
20-
token: ${{ secrets.GITHUB_TOKEN }}
21-
22-
- name: Sync Upstream (Exclude .github)
23-
run: |
24-
# Configure Git Identity
25-
git config --global user.name 'GitHub Actions'
26-
git config --global user.email 'actions@github.com'
2719

28-
# Add Upstream Remote
29-
git remote add upstream https://github.com/GoogleCloudPlatform/magic-modules.git
30-
git fetch upstream
31-
32-
# Merge upstream/main into local branch
33-
# --no-commit: Stops git from finalizing the merge automatically
34-
# --no-ff: Creates a merge commit to keep history clear
35-
# || true: Prevents the workflow from failing if there are conflicts immediately (we handle them next)
36-
git merge upstream/main --no-commit --no-ff || true
20+
- name: Sync upstream changes
21+
id: sync
22+
uses: aormsby/Fork-Sync-With-Upstream-action@v3.4
23+
with:
24+
upstream_sync_repo: GoogleCloudPlatform/magic-modules
25+
upstream_sync_branch: main
26+
target_sync_branch: main
27+
target_repo_token: ${{ secrets.GITHUB_TOKEN }} # Automatically generated, no need to set this
3728

38-
# This command forces the .github folder back to the state of YOUR repo (HEAD),
39-
# effectively ignoring any changes upstream made to this folder.
40-
git checkout HEAD -- .github
41-
42-
# Optional: If you have other specific files to ignore, add them here:
43-
# git checkout HEAD -- another_file.txt
29+
# Set test_mode to true to run tests without pushing changes
30+
test_mode: false
4431

45-
# Commit and Push
46-
# We check if there are actual changes to commit before pushing
47-
if [[ -n $(git status -s) ]]; then
48-
echo "Changes detected. Committing..."
49-
git add .
50-
git commit -m "Sync upstream changes (preserving local .github config)"
51-
git push
52-
else
53-
echo "No changes to sync."
54-
fi
55-
5632
- name: Timestamp
5733
run: date

0 commit comments

Comments
 (0)