Repository navigation
73 lines (58 loc) · 2 KB
/
Copy pathsync-develop.yaml
File metadata and controls
73 lines (58 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
name: Sync Develop Branch
# Automatically update the develop branch whenever commits are merged to main.
# This ensures develop stays in sync with main without manual intervention.
on:
workflow_dispatch:
# push:
# branches:
# - main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
sync-develop:
name: Update Develop Branch
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Harden runner
# renovate: datasource=github-tags depName=DevSecNinja/.github
uses: DevSecNinja/.github/actions/harden-runner@bf22fcfcb4ef94a359eed55cea4b5ce7f5b98167 # main
- name: Checkout repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
ref: main
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Wait for other merges
run: |
echo "⏳ Waiting 60 seconds for other potential merges to complete..."
sleep 60
echo "✅ Wait complete, proceeding with sync"
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Sync develop branch
run: |
# Fetch the latest develop branch
git fetch origin develop:develop
# Checkout develop branch
git checkout develop
# Merge main into develop
git merge origin/main --no-edit \
-m "chore: sync develop with main [skip ci]"
# Push changes to develop
git push origin develop
- name: Report status
if: success()
run: |
echo "✅ Successfully synced develop branch with main"
- name: Report failure
if: failure()
run: |
echo "❌ Failed to sync develop branch"
echo "May require manual intervention if there are merge conflicts"