Skip to content

Commit

Permalink
Merge pull request #139 from tegonal/dependency/github-commons
Browse files Browse the repository at this point in the history
update to github-commons v1.0.0; fix and adopt pull-hook-functions.sh
  • Loading branch information
robstoll authored Aug 16, 2023
2 parents a5ee805 + 15b456b commit 8e298ce
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 139 deletions.
5 changes: 2 additions & 3 deletions .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: v0.8.0
# Version: v1.0.0
#
###################################

Expand All @@ -15,7 +15,6 @@ root = true
[*]
charset = utf-8
indent_style = tab
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
Expand All @@ -24,5 +23,5 @@ trim_trailing_whitespace = true
insert_final_newline = false
trim_trailing_whitespace = false

[*.{yml,sh}]
[*.{yml,yaml}]
indent_size = 2
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: v0.8.0
# Version: v1.0.0
#
###################################
-->
Expand Down
212 changes: 106 additions & 106 deletions .github/Contributor Agreement.txt

Large diffs are not rendered by default.

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: v0.8.0
# Version: v1.0.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: v0.8.0
# Version: v1.0.0
#
###################################
name: Cleanup
Expand All @@ -22,7 +22,7 @@ jobs:
- name: Cleanup Sources
run: ./scripts/cleanup-on-push-to-main.sh
- name: Create Pull Request if necessary
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@v5
with:
branch: auto-cleanup
title: Auto Cleanup
Expand Down
35 changes: 26 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: v0.8.0
# Version: v1.0.0
#
####### Description #############
#
Expand All @@ -31,16 +31,15 @@
# declare _tag=$1 source=$2 _target=$3
# shift 3 || die "could not shift by 3"
#
# replacePlaceholdersContributorsAgreement "$source" "my-project-name"
# replacePlaceholderPullRequestTemplate "$source" "https://github.com/tegonal/my-project-name" "$MY_PROJECT_LATEST_VERSION"
# replacePlaceholdersContributorsAgreement "$source" "my-project-name" "MyCompanyName, Country"
# replacePlaceholdersPullRequestTemplate "$source" "https://github.com/tegonal/my-project-name" "$MY_PROJECT_LATEST_VERSION"
#
# # also have a look at https://github.com/tegonal/gt/blob/main/.gt/remotes/tegonal-scripts/pull-hook.sh
#
###################################
set -euo pipefail
shopt -s inherit_errexit
unset CDPATH
export GT_VERSION='v0.5.0-SNAPSHOT'

if ! [[ -v dir_of_github_commons ]]; then
dir_of_github_commons="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/null && pwd 2>/dev/null)/.."
Expand All @@ -53,8 +52,27 @@ if ! [[ -v dir_of_tegonal_scripts ]]; then
fi

function replacePlaceholdersContributorsAgreement() {
if ! (($# == 3)); then
logError "you need to pass three arguments to replacePlaceholdersContributorsAgreement"
echo "1: file represents the 'Contributor Agreement.txt'"
echo "2: projectName the name of the project"
echo "3: owner owner of the project"
printStackTrace
exit 9
fi
local -r file=$1
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;" \
"$file"
}

function replacePlaceholdersContributorsAgreement_Tegonal() {
if ! (($# == 2)); then
logError "you need to pass two arguments to replacePlaceholdersContributorsAgreement"
logError "you need to pass two arguments to replacePlaceholdersContributorsAgreement_Tegonal"
echo "1: file represents the 'Contributor Agreement.txt'"
echo "2: projectName the name of the project"
printStackTrace
Expand All @@ -63,12 +81,12 @@ function replacePlaceholdersContributorsAgreement() {
local -r file=$1
local -r projectName=$2
shift 2 || die "could not shift by 2"
perl -0777 -i -pe "s/<PROJECT_NAME>/$projectName/g" "$file"
replacePlaceholdersContributorsAgreement "$file" "$projectName" "Tegonal Genossenschaft, Switzerland"
}

function replacePlaceholderPullRequestTemplate() {
function replacePlaceholdersPullRequestTemplate() {
if ! (($# == 3)); then
logError "you need to pass three arguments to replacePlaceholderPullRequestTemplate"
logError "you need to pass three arguments to replacePlaceholdersPullRequestTemplate"
echo "1: file represents the 'PULL_REQUEST_TEMPLATE.md'"
echo "2: url the github url"
echo "3: latestTag latest tag"
Expand All @@ -85,7 +103,6 @@ function replacePlaceholderPullRequestTemplate() {
"$file"
}


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

if ! [[ -v dir_of_tegonal_scripts ]]; then
dir_of_tegonal_scripts="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/null && pwd 2>/dev/null)/../../../lib/tegonal-scripts/src"
dir_of_tegonal_scripts="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/null && pwd 2>/dev/null)/../../src"
source "$dir_of_tegonal_scripts/setup.sh" "$dir_of_tegonal_scripts"
fi

if ! [[ -v dir_of_github_commons ]]; then
dir_of_github_commons="$dir_of_tegonal_scripts/../../../.gt/remotes/tegonal-gh-commons/lib/src"
dir_of_github_commons="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/null && pwd 2>/dev/null)/lib/src"
readonly dir_of_github_commons
fi

Expand All @@ -28,22 +28,22 @@ sourceOnce "$dir_of_tegonal_scripts/utility/parse-fn-args.sh"

function gt_pullHook_tegonal_gh_commons_before() {
local _tag source _target
# shellcheck disable=SC2034
# shellcheck disable=SC2034 # is passed to parseFnArgs by name
local -ra params=(_tag source _target)
parseFnArgs params "$@"

if [[ $source =~ .*/\.github/Contributor[[:space:]]Agreement\.txt ]]; then
replacePlaceholdersContributorsAgreement "$source" "tegonal-scripts"
replacePlaceholdersContributorsAgreement_Tegonal "$source" "tegonal-scripts"
elif [[ $source =~ .*/\.github/PULL_REQUEST_TEMPLATE.md ]]; then
# same as in additional-release-files-preparations.sh
local -r githubUrl="https://github.com/tegonal/scripts"
replacePlaceholderPullRequestTemplate "$source" "$githubUrl" "$TEGONAL_SCRIPTS_LATEST_VERSION"
replacePlaceholdersPullRequestTemplate "$source" "$githubUrl" "$TEGONAL_SCRIPTS_LATEST_VERSION"
fi
}

function gt_pullHook_tegonal_gh_commons_after() {
local _tag source target
# shellcheck disable=SC2034
# shellcheck disable=SC2034 # is passed to parseFnArgs by name
local -ra params=(_tag source target)
parseFnArgs params "$@"

Expand Down
20 changes: 10 additions & 10 deletions .gt/remotes/tegonal-gh-commons/pulled.tsv
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
tag file relativeTarget sha512
v0.8.0 src/.github/workflows/cleanup.yml ../.github/workflows/cleanup.yml 182304c829bf37dc5aea70a988699490f45e6c02c8cb993200070da7c6a845d58623b13350f608f878a212433ace856d6d9bdf37594810463fa873a83719b5b7
v0.8.0 src/.github/dependabot.yml ../.github/dependabot.yml 37f53a06cd7fce85e108cc23870494acfa807a23b381b659e38903f5476516ccf04e902e8aae64781e178d1bc855c5fcba85e50f035c83e497377babd0234f53
v0.8.0 src/.github/CODE_OF_CONDUCT.md ../.github/CODE_OF_CONDUCT.md 413c8703156a7ce2196310112cba1a8e62041ba1813c43f75edccb630115ace335576f410fd60d53420b4f877dbe0f067afe9680ff6c41f98fb4c14d57207ff0
v0.8.0 src/.github/PULL_REQUEST_TEMPLATE.md ../.github/PULL_REQUEST_TEMPLATE.md 9112d1ea1f72ea250cdfe686fc152e63f2e0cdcea9c46935289471d7a3f54c35af8a3f283570f5d863e936c7782939c7b1548cb7d4ccda712bbf9314926f58cb
v0.8.0 src/gt/pull-hook-functions.sh remotes/tegonal-gh-commons/lib/src/gt/pull-hook-functions.sh 26710da23d3480dfd9234567e708f70bfab9e4b29a1bbd6ad0cd66785db82e67e92414a9d2afcaac85fa02e87033f64201da6774efcf6419b1c4b08306510c99
v0.8.0 src/.github/Contributor Agreement.txt ../.github/Contributor Agreement.txt f3b5080e1e1f23e6c5a44a23d0911f55df4e754de3fdbc377d8feb4b6d053482810e02e1bca15764136209dd791666e5d28c672b41c056da33e649b1bd56c806
v0.8.0 src/gt/signing-key.public.asc signing-key.public.asc f60d6119f8083da722199a90ffb61273d404ba74dd01fe6712d1d1157dd0037e9618eb99f1d7f85450508d25f2ea33f869ee04ef11206c7e420f02b27738ae9b
v0.8.0 src/gt/signing-key.public.asc.actual_sig signing-key.public.asc.actual_sig e854eb98125782f99bab8cf3663392f9e24c8d3c90911e7688152b13550981c47d8e79efbb540521163abcb4c16e33c8e1270a424655057bd224bb9b4dff329d
v0.8.0 src/dotfiles/.editorconfig ../.editorconfig c9892e91ff7c3843e994ac5708b1a04b5c50698ac2bd7a7879663b468a0a8a4f6be4ea26b6bb9bd72dbe3f2324310f2c02293be8516da37cedd9c60e9c756c1f
v0.8.0 src/dotfiles/.shellcheckrc ../.shellcheckrc 5e4b61727cacc856caccc1a3dbf1b261be77ba00784582c9f4c0717d34ab8f9e75689af735afe2eec8a6ce13d5c541eb26c513cec7c656ccb9c3f8e51a8164d9
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/.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/gt/signing-key.public.asc signing-key.public.asc f60d6119f8083da722199a90ffb61273d404ba74dd01fe6712d1d1157dd0037e9618eb99f1d7f85450508d25f2ea33f869ee04ef11206c7e420f02b27738ae9b
v1.0.0 src/gt/signing-key.public.asc.actual_sig signing-key.public.asc.actual_sig e854eb98125782f99bab8cf3663392f9e24c8d3c90911e7688152b13550981c47d8e79efbb540521163abcb4c16e33c8e1270a424655057bd224bb9b4dff329d
v1.0.0 src/dotfiles/.editorconfig ../.editorconfig 0395c3361c283ca83081823b5e7eaa3b6309e40b0fa66a9905e69a7aa7ca6cb94a313ec95f9292bad144b225af8de4578e6b59a372f0637314fa41cb9e76f7b5
v1.0.0 src/dotfiles/.shellcheckrc ../.shellcheckrc 7f0ffaa1380a62c015fd01bdc94926ca61bfd824b21828bb597b944fbdc866f684d1e2e167aeb5d49df7f157109ac3fdd36d772e5339695fde1e694fcef011b1
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: v0.8.0
# Version: v1.0.0
#
###################################

Expand Down

0 comments on commit 8e298ce

Please sign in to comment.