Skip to content

Commit d5ed469

Browse files
author
Frederic Spiers
committed
fix(sh): contrib script
1 parent 9d06d7e commit d5ed469

File tree

2 files changed

+16
-47
lines changed

2 files changed

+16
-47
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# GitGuardian Helm charts forked repository
2+
## Contribute
3+
4+
When improving our charts, it is necessary to contribute upstream on `Cloudpirates.io`.
5+
6+
1. Execute `./contrib.sh <new-branch>` script to start new contribution
7+
2. Cherry-pick your changes
8+
3. Create a new PR on upstream main branch
9+
110
<p align="center">
211
<a href="https://artifacthub.io/packages/search?org=cloudpirates">
312
<img src="https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/cloudpirates" />

contrib.sh

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,12 @@
11
#!/bin/bash
22

3-
ACTION=$1
4-
BRANCH_NAME=$2
3+
BRANCH_NAME=$1
54

6-
if [ -z "$BRANCH_NAME" ]; then
7-
echo "Usage: $0 <branch-name> [start|finish]"
8-
echo " start: Start new contribution"
9-
echo " finish: Restore upstream diff"
10-
exit 1
11-
fi
5+
echo "🔄 Synchronisation with upstream..."
6+
git checkout main
7+
git fetch upstream
128

13-
case $ACTION in
14-
"start")
15-
echo "🔄 Synchronisation with upstream..."
16-
git checkout main
17-
git fetch origin
9+
echo "🌿 Prepare contrib from upstream/main"
10+
git checkout -b "$BRANCH_NAME" upstream/main
1811

19-
git fetch upstream
20-
git diff upstream/main > diff-upstream.patch
21-
22-
echo "🗑️ Deleting upstream diff before contrib..."
23-
git apply -R diff-upstream.patch
24-
echo "✅ Upstream diff deleted"
25-
26-
echo "🌿 Creating branch $BRANCH_NAME..."
27-
git checkout -b "$BRANCH_NAME"
28-
29-
echo "🌿 Prepare contrib by deleting diff"
30-
git add -A
31-
git reset HEAD diff-upstream.patch
32-
git commit -m "refactor(contrib): prepare contribution"
33-
git push origin "$BRANCH_NAME"
34-
35-
echo "✅ Ready for contrib !"
36-
;;
37-
38-
"finish")
39-
echo "🔄 Return to main..."
40-
git checkout main
41-
42-
echo "🔧 Restore upstream diff workflows..."
43-
git apply diff-upstream.patch
44-
45-
echo "✅ Ready !"
46-
;;
47-
48-
*)
49-
echo "Unkown action: $ACTION"
50-
echo "Use start or finish"
51-
;;
52-
esac
12+
echo "✅ Ready for contrib !"

0 commit comments

Comments
 (0)