Skip to content

Commit 30474b9

Browse files
author
Frederic Spiers
committed
chore(contrib): update contrib script
1 parent 60a1567 commit 30474b9

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

contrib.sh

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,33 @@ ACTION=$1
44
BRANCH_NAME=$2
55

66
if [ -z "$BRANCH_NAME" ]; then
7-
echo "Usage: $0 <branch-name> [start|finish|update]"
8-
echo " start: Start new contribution"
9-
echo " finish: Restore private workflows"
7+
echo "Usage: $0 <branch-name> [start|finish]"
8+
echo " start: Start new contribution"
9+
echo " finish: Restore upstream diff"
1010
exit 1
1111
fi
1212

1313
case $ACTION in
1414
"start")
1515
echo "🔄 Synchronisation with upstream..."
1616
git checkout main
17+
git fetch origin
1718

1819
git fetch upstream
19-
git diff upstream/main -- .github/workflows/ > private-workflows.patch
20+
git diff upstream/main > diff-upstream.patch
2021

21-
echo "🗑️ Deleting private workflows before contrib..."
22-
git apply -R private-workflows.patch
23-
echo "Private workflows deleted"
22+
echo "🗑️ Deleting upstream diff before contrib..."
23+
git apply -R diff-upstream.patch
24+
echo "Upstream diff deleted"
2425

2526
echo "🌿 Creating branch $BRANCH_NAME..."
2627
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"
2734

2835
echo "✅ Ready for contrib !"
2936
;;
@@ -32,14 +39,14 @@ case $ACTION in
3239
echo "🔄 Return to main..."
3340
git checkout main
3441

35-
echo "🔧 Restore private workflows..."
36-
git apply private-workflows.patch
42+
echo "🔧 Restore upstream diff workflows..."
43+
git apply diff-upstream.patch
3744

3845
echo "✅ Ready !"
3946
;;
4047

4148
*)
42-
echo "Action inconnue: $ACTION"
43-
echo "Utilisez: start or finish"
49+
echo "Unkown action: $ACTION"
50+
echo "Use start or finish"
4451
;;
4552
esac

0 commit comments

Comments
 (0)