File tree Expand file tree Collapse file tree 1 file changed +29
-4
lines changed Expand file tree Collapse file tree 1 file changed +29
-4
lines changed Original file line number Diff line number Diff line change 1
- #! /bin/bash
2
- cd minetest_game
3
- git subtree split -P mods/$1 -b $1
4
- git push " https://x-access-token:${access_token} @github.com/minetest-game/${1} .git" ${1} :master
1
+ #! /usr/bin/env bash
2
+
3
+ set -euxo pipefail
4
+
5
+ _git_subtree_branch_prefix=" ___"
6
+ _git_branch=" $( git rev-parse --abbrev-ref HEAD) "
7
+ GITHUB_OWNER=" ${GITHUB_REPOSITORY%%/* } "
8
+
9
+ for _i in " ${@ } " ; do
10
+
11
+ [ -e " ${_i} " ] || continue
12
+
13
+ _dir=" ${_i} "
14
+ _basename=" $( basename " ${_i} " ) "
15
+
16
+ git subtree split -P " ${_dir} " -b " ${_git_subtree_branch_prefix}${_basename} " \
17
+ || exit 1
18
+
19
+ done
20
+
21
+ readarray -t _git_branches < <( git branch --list " ${_git_subtree_branch_prefix} *" )
22
+
23
+ for _i in " ${_git_branches} " ; do
24
+
25
+ _git_subtree_branch=" ${_i} "
26
+ _git_remote_repo_name=" ${_git_subtree_branch# ${_git_subtree_branch_prefix} } "
27
+ git push " https://x-access-token:${ACCESS_TOKEN} @github.com/${GITHUB_OWNER} /${_git_remote_repo_name} .git" " ${_git_subtree_branch} :${_git_branch} "
28
+
29
+ done
You can’t perform that action at this time.
0 commit comments