@@ -24,7 +24,7 @@ required_tool() {
2424}
2525
2626# If any required arguments is missing, print the usage and exit
27- if [ -z " ${LANGUAGE} " ] || [ -z " ${SLUG} " ]; then
27+ if [[ -z " ${LANGUAGE} " || -z " ${SLUG} " ] ]; then
2828 help_and_exit
2929fi
3030
@@ -39,11 +39,13 @@ REPO_DIR=$(mktemp -d)
3939cp -a . " ${REPO_DIR} "
4040cd " ${REPO_DIR} " || die " Failed to cd to ${REPO_DIR} "
4141
42- for file in $( git grep --files-with-matches replace-this-with-the-track-slug) ; do
42+ mapfile -t files < <( git grep --files-with-matches replace-this-with-the-track-slug)
43+ for file in " ${files[@]} " ; do
4344 sed -i " s/replace-this-with-the-track-slug/${SLUG} /g" " ${file} "
4445done
4546
46- for file in $( git grep --files-with-matches replace-this-with-the-track-name) ; do
47+ mapfile -t files < <( git grep --files-with-matches replace-this-with-the-track-name)
48+ for file in " ${files[@]} " ; do
4749 sed -i " s/replace-this-with-the-track-name/${LANGUAGE} /g" " ${file} "
4850done
4951
@@ -71,7 +73,37 @@ gh api --method PUT "/orgs/${ORG}/actions/secrets/DOCKERHUB_PASSWORD/repositorie
7173gh api --method PUT " /orgs/${ORG} /actions/secrets/DOCKERHUB_USERNAME/repositories/${REPO_ID} "
7274
7375# Create ruleset for default branch
74- jq -n ' {name: "Default branch", target: "branch", enforcement: "active", conditions: {ref_name: {include: ["~DEFAULT_BRANCH"], exclude:[]}}, rules:[{type: "pull_request", parameters: {dismiss_stale_reviews_on_push: false, require_code_owner_review: true,require_last_push_approval: false, required_approving_review_count: 0, required_review_thread_resolution: false}}], "bypass_actors":[{"actor_id": 1, "actor_type": "OrganizationAdmin", "bypass_mode": "always"}]}' | gh api --method POST " /repos/${REPO} /rulesets" --input -
76+ jq -n '
77+ {
78+ name: "Default branch",
79+ target: "branch",
80+ enforcement: "active",
81+ conditions: {
82+ ref_name: {
83+ include: ["~DEFAULT_BRANCH"],
84+ exclude:[]
85+ }
86+ },
87+ rules: [
88+ {
89+ type: "pull_request",
90+ parameters: {
91+ dismiss_stale_reviews_on_push: false,
92+ require_code_owner_review: true,
93+ require_last_push_approval: false,
94+ required_approving_review_count: 0,
95+ required_review_thread_resolution: false
96+ }
97+ }
98+ ],
99+ "bypass_actors": [
100+ {
101+ "actor_id": 1,
102+ "actor_type": "OrganizationAdmin",
103+ "bypass_mode": "always"
104+ }
105+ ]
106+ }' | gh api --method POST " /repos/${REPO} /rulesets" --input -
75107
76108# Add topics
77109gh api --method PUT " /repos/${REPO} /topics" -f " names[]=exercism-test-runner" -f " names[]=exercism-tooling"
0 commit comments