Skip to content

Commit

Permalink
update tegonal-github-commons to v1.1.0 and adjust pull-hook accordingly
Browse files Browse the repository at this point in the history
One needs to specify the owner email (in our case we can use the special
function replacePlaceholdersCodeOfConduct_Tegonal)
  • Loading branch information
robstoll committed Nov 5, 2023
1 parent a464728 commit 86f891b
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 23 deletions.
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / It is licensed under Creative Commons Zero v1.0 Universal
# \__/\__/\_, /\___/_//_/\_,_/_/ Please report bugs and contribute back your improvements
# /___/
# Version: v1.0.0
# Version: v1.1.0
#
###################################

Expand All @@ -25,3 +25,6 @@ trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[*.bat]
end_of_line = crlf
2 changes: 1 addition & 1 deletion .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / It is licensed under Creative Commons Zero v1.0 Universal
# \__/\__/\_, /\___/_//_/\_,_/_/ Please report bugs and contribute back your improvements
# /___/
# Version: v1.0.0
# Version: v1.1.0
#
###################################
-->
Expand Down
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / It is licensed under Creative Commons Zero v1.0 Universal
# \__/\__/\_, /\___/_//_/\_,_/_/ Please report bugs and contribute back your improvements
# /___/
# Version: v1.0.0
# Version: v1.1.0
#
###################################
version: 2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / It is licensed under Creative Commons Zero v1.0 Universal
# \__/\__/\_, /\___/_//_/\_,_/_/ Please report bugs and contribute back your improvements
# /___/
# Version: v1.0.0
# Version: v1.1.0
#
###################################
name: Cleanup
Expand All @@ -18,7 +18,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Cleanup Sources
run: ./scripts/cleanup-on-push-to-main.sh
- name: Create Pull Request if necessary
Expand Down
48 changes: 39 additions & 9 deletions .gt/remotes/tegonal-gh-commons/lib/src/gt/pull-hook-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / It is licensed under Creative Commons Zero v1.0 Universal
# \__/\__/\_, /\___/_//_/\_,_/_/ Please report bugs and contribute back your improvements
# /___/
# Version: v1.0.0
# Version: v1.1.0
#
####### Description #############
#
Expand All @@ -18,8 +18,9 @@
# shopt -s inherit_errexit
# MY_PROJECT_LATEST_VERSION="v1.0.0"
#
# # Assumes tegonal's github-commons was fetched with gt - adjust location accordingly
# dir_of_github_commons="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/null && pwd 2>/dev/null)/../lib/tegonal-gh-common/src"
# # Assumes tegonal's github-commons was fetched with gt and put into repoRoot/.gt/remotes/tegonal-gh-commons/lib
# # - adjust remote name or location accordingly
# dir_of_github_commons="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/null && pwd 2>/dev/null)/lib/src"
#
# if ! [[ -v dir_of_tegonal_scripts ]]; then
# dir_of_tegonal_scripts="$dir_of_github_commons/../tegonal-scripts/src"
Expand All @@ -31,6 +32,7 @@
# declare _tag=$1 source=$2 _target=$3
# shift 3 || die "could not shift by 3"
#
# replacePlaceholdersCodeOfConduct "$source" "[email protected]"
# replacePlaceholdersContributorsAgreement "$source" "my-project-name" "MyCompanyName, Country"
# replacePlaceholdersPullRequestTemplate "$source" "https://github.com/tegonal/my-project-name" "$MY_PROJECT_LATEST_VERSION"
#
Expand Down Expand Up @@ -64,9 +66,9 @@ function replacePlaceholdersContributorsAgreement() {
local -r projectName=$2
local -r owner=$3
shift 3 || die "could not shift by 3"
perl -0777 -i \
-pe "s/<PROJECT_NAME>/$projectName/g;" \
-pe "s/<OWNER>/$owner/g;" \
PROJECT_NAME="$projectName" OWNER="$owner" perl -0777 -i \
-pe 's/<PROJECT_NAME>/$ENV{PROJECT_NAME}/g;' \
-pe 's/<OWNER>/$ENV{OWNER}/g;' \
"$file"
}

Expand Down Expand Up @@ -97,12 +99,40 @@ function replacePlaceholdersPullRequestTemplate() {
local -r url=$2
local -r tag=$3
shift 3 || die "could not shift by 3"
perl -0777 -i \
-pe "s#<GITHUB_URL>#$url#g;" \
-pe "s#<TAG>#$tag#g;" \
TAG="$tag" GITHUB_URL="$url" perl -0777 -i \
-pe 's#<GITHUB_URL>#$ENV{GITHUB_URL}#g;' \
-pe 's#<TAG>#$ENV{TAG}#g;' \
"$file"
}

function replacePlaceholdersCodeOfConduct(){
if ! (($# == 2)); then
logError "you need to pass two arguments to replacePlaceholdersCodeOfConductTemplate"
echo "1: file represents the 'CODE_OF_CONDUCT.md'"
echo "2: owner_email email address which should be contacted in case of a violation"
printStackTrace
exit 9
fi
local -r file=$1
local -r ownerEmail=$2
shift 2 || die "could not shift by 2"
EMAIL="$ownerEmail" perl -0777 -i \
-pe 's/<OWNER_EMAIL>/$ENV{EMAIL}/g;' \
"$file"
}

function replacePlaceholdersCodeOfConduct_Tegonal(){
if ! (($# == 1)); then
logError "you need to pass one arguments to replacePlaceholdersCodeOfConductTemplate"
echo "1: file represents the 'CODE_OF_CONDUCT.md'"
printStackTrace
exit 9
fi
local -r file=$1
shift 1 || die "could not shift by 1"
replacePlaceholdersCodeOfConduct "$file" "[email protected]"
}

function replaceTagInPullRequestTemplate() {
if ! (($# == 3)); then
logError "you need to pass three arguments to replaceTagInPullRequestTemplate"
Expand Down
2 changes: 2 additions & 0 deletions .gt/remotes/tegonal-gh-commons/pull-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ function gt_pullHook_tegonal_gh_commons_before() {

if [[ $source =~ .*/\.github/Contributor[[:space:]]Agreement\.txt ]]; then
replacePlaceholdersContributorsAgreement_Tegonal "$source" "minimalist"
elif [[ $source =~ .*/\.github/CODE_OF_CONDUCT.md ]]; then
replacePlaceholdersCodeOfConduct_Tegonal "$source"
elif [[ $source =~ .*/\.github/PULL_REQUEST_TEMPLATE.md ]]; then
# same as in additional-release-files-preparations.sh
local -r githubUrl="https://github.com/tegonal/minimalist"
Expand Down
17 changes: 9 additions & 8 deletions .gt/remotes/tegonal-gh-commons/pulled.tsv
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#@ Version: 1.0.0
tag file relativeTarget sha512
v1.0.0 src/.github/CODE_OF_CONDUCT.md ../.github/CODE_OF_CONDUCT.md 2a40d61e7f7527f37b66623197393ad8aa1ba7156900595dc9dc32e628c7fdeaa57795238fa89a3cc98cb921149dcc03f3938c917ddf8ce03af0aa9cd4fef829
v1.0.0 src/.github/PULL_REQUEST_TEMPLATE.md ../.github/PULL_REQUEST_TEMPLATE.md 9112d1ea1f72ea250cdfe686fc152e63f2e0cdcea9c46935289471d7a3f54c35af8a3f283570f5d863e936c7782939c7b1548cb7d4ccda712bbf9314926f58cb
v1.0.0 src/gt/pull-hook-functions.sh remotes/tegonal-gh-commons/lib/src/gt/pull-hook-functions.sh e837edf3d980add930f81062298ce052f053458789a7b09f16c7874bab20ce8a14ac6ee24c4f8dcc923a80e0662a46c42de83fcc755807f3f1a7fa65ff386fc5
v1.0.0 src/.github/Contributor Agreement.txt ../.github/Contributor Agreement.txt 8ae9a779436b7e3c1bb1ebc3317b5d53fca85acfd53ecdb9c22c7bc3ed063f01f8dad2e8cfc5dfea0bde47d61c09e6323f4b1510c96a2bc8ffacf0b572b0e6ab
v1.0.0 src/dotfiles/.editorconfig ../.editorconfig 0395c3361c283ca83081823b5e7eaa3b6309e40b0fa66a9905e69a7aa7ca6cb94a313ec95f9292bad144b225af8de4578e6b59a372f0637314fa41cb9e76f7b5
v1.0.0 src/.github/workflows/cleanup.yml ../.github/workflows/cleanup.yml 2280253fa8846af3d1af8d4553c90bcae5d5dd6bb68704efa5e7a6bb6c48e42a3d25e55f0320177f97cd8be7b65ba16f1539e8c20218751a11ec48ebb9567f22
v1.0.0 src/.github/dependabot.yml ../.github/dependabot.yml 056cb647b4978b6dc50dcb7f9378f26c48d35a48e511cd9237bbf64930ab1e70dcc3db9bb4827964c55ee1a65d8d89a8bbd91d3255b4754adffc79b0bd895576
v1.0.0 src/dotfiles/.shellcheckrc ../.shellcheckrc 7f0ffaa1380a62c015fd01bdc94926ca61bfd824b21828bb597b944fbdc866f684d1e2e167aeb5d49df7f157109ac3fdd36d772e5339695fde1e694fcef011b1
v1.1.0 src/.github/CODE_OF_CONDUCT.md ../.github/CODE_OF_CONDUCT.md e7b2fb4597b0649fd891899a5807538ae122f85dfc128a7e21a6431ba493c62beae4ea324b666559d9e2fafbb76ae80f378fde24d0d454ffd15936563bbc8433
v1.1.0 src/.github/PULL_REQUEST_TEMPLATE.md ../.github/PULL_REQUEST_TEMPLATE.md 9112d1ea1f72ea250cdfe686fc152e63f2e0cdcea9c46935289471d7a3f54c35af8a3f283570f5d863e936c7782939c7b1548cb7d4ccda712bbf9314926f58cb
v1.1.0 src/gt/pull-hook-functions.sh remotes/tegonal-gh-commons/lib/src/gt/pull-hook-functions.sh 14909cfe7f2c0af16f49b20289dedf680e4fd776c40c8b2f7e3c5e513f441f9dc675c8271a6c43d62a1e1a1a730e91c1a96e4363feb2b0d17f1a01f60363c16c
v1.1.0 src/.github/Contributor Agreement.txt ../.github/Contributor Agreement.txt 8ae9a779436b7e3c1bb1ebc3317b5d53fca85acfd53ecdb9c22c7bc3ed063f01f8dad2e8cfc5dfea0bde47d61c09e6323f4b1510c96a2bc8ffacf0b572b0e6ab
v1.1.0 src/dotfiles/.editorconfig ../.editorconfig f015c82e933f0cd954bed51451d7640c6f289d9d1a60f461746648bf7b88a7e93ba36b678dfa2fb4290b9a4ad73bea698531d3ff77c04b23982e6c4be477e876
v1.1.0 src/.github/workflows/cleanup.yml ../.github/workflows/cleanup.yml efa06802a7b2ba6f676ee77056d2d7c219da2652e92fa5bdaea045143a927de26c12fe547c43b5e8ad4f78af2d051c680c76f4e6cb1b726cac519e476aace8f6
v1.1.0 src/.github/dependabot.yml ../.github/dependabot.yml 07d190f91d13e337d5ebaf5c9ee5e749f4469e275628dc0c1ef925f169a5b9bf39c5ff555df9d2a9e66e13d9a39351c442adec7cd2b0feffee7e58d66886cca7
v1.1.0 src/dotfiles/.shellcheckrc ../.shellcheckrc 3bdce07d2407f4632eeb3e4ac7c60e6b840ca95084a9fd3ccdcc983b585887a8ea8c15e36327efacea03cf9f6b5704cb64ac71607725171dd899d9df04dd438c
2 changes: 1 addition & 1 deletion .shellcheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / It is licensed under Creative Commons Zero v1.0 Universal
# \__/\__/\_, /\___/_//_/\_,_/_/ Please report bugs and contribute back your improvements
# /___/
# Version: v1.0.0
# Version: v1.1.0
#
###################################

Expand Down

0 comments on commit 86f891b

Please sign in to comment.