-
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (52 loc) · 1.59 KB
/
sync-upstream.yml
File metadata and controls
59 lines (52 loc) · 1.59 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
---
name: Sync Upstream (Reusable)
on:
workflow_call:
inputs:
upstream-path:
description: 'Path to upstream submodule'
required: true
type: string
chart-path:
description: 'Path to chart directory'
required: true
type: string
sync-script:
description: 'Path to sync script'
required: false
type: string
default: 'scripts/sync.sh'
jobs:
sync:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v5
with:
submodules: true
- name: Update submodule and sync
id: update
run: |
cd ${{ inputs.upstream-path }}
git fetch origin
LATEST_TAG=$(git describe --tags --abbrev=0 origin/main 2>/dev/null || echo "main")
git checkout $LATEST_TAG
echo "tag=${LATEST_TAG}" >> $GITHUB_OUTPUT
cd "$GITHUB_WORKSPACE"
chmod +x ${{ inputs.sync-script }}
${{ inputs.sync-script }}
- name: Create Pull Request
if: success()
uses: peter-evans/create-pull-request@v7
with:
commit-message: "chore: sync upstream to ${{ steps.update.outputs.tag }}"
title: "Sync upstream to ${{ steps.update.outputs.tag }}"
body: |
Automated upstream synchronization to `${{ steps.update.outputs.tag }}`.
Review and test before merging.
branch: sync/${{ steps.update.outputs.tag }}
delete-branch: true
labels: upstream-sync