Skip to content

Commit

Permalink
Merge pull request #155 from tegonal/update/github-commons
Browse files Browse the repository at this point in the history
update github-commons to 2.0.0
  • Loading branch information
robstoll authored Mar 7, 2024
2 parents 413277e + d2c2b23 commit 662aa83
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 75 deletions.
8 changes: 4 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#
# __ __
# / /____ ___ ____ ___ ___ _/ / This file is provided to you by https://github.com/tegonal/github-commons
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / It is licensed under Creative Commons Zero v1.0 Universal
# \__/\__/\_, /\___/_//_/\_,_/_/ Please report bugs and contribute back your improvements
# /___/
# Version: v1.2.1
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / Copyright 2022 Tegonal Genossenschaft <[email protected]>
# \__/\__/\_, /\___/_//_/\_,_/_/ It is licensed under Creative Commons Zero v1.0 Universal
# /___/ Please report bugs and contribute back your improvements
#
# Version: v2.1.1
###################################

# https://editorconfig.org
Expand Down
8 changes: 4 additions & 4 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#
# __ __
# / /____ ___ ____ ___ ___ _/ / This file is provided to you by https://github.com/tegonal/github-commons
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / It is licensed under Creative Commons Zero v1.0 Universal
# \__/\__/\_, /\___/_//_/\_,_/_/ Please report bugs and contribute back your improvements
# /___/
# Version: v1.2.1
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / Copyright 2022 Tegonal Genossenschaft <[email protected]>
# \__/\__/\_, /\___/_//_/\_,_/_/ It is licensed under Creative Commons Zero v1.0 Universal
# /___/ Please report bugs and contribute back your improvements
#
# Version: v2.1.1
###################################
-->
# Contributor Covenant Code of Conduct
Expand Down
8 changes: 4 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#
# __ __
# / /____ ___ ____ ___ ___ _/ / This file is provided to you by https://github.com/tegonal/github-commons
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / It is licensed under Creative Commons Zero v1.0 Universal
# \__/\__/\_, /\___/_//_/\_,_/_/ Please report bugs and contribute back your improvements
# /___/
# Version: v1.2.1
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / Copyright 2022 Tegonal Genossenschaft <[email protected]>
# \__/\__/\_, /\___/_//_/\_,_/_/ It is licensed under Creative Commons Zero v1.0 Universal
# /___/ Please report bugs and contribute back your improvements
#
# Version: v2.1.1
###################################
version: 2
updates:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#
# __ __
# / /____ ___ ____ ___ ___ _/ / This file is provided to you by https://github.com/tegonal/github-commons
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / It is licensed under Creative Commons Zero v1.0 Universal
# \__/\__/\_, /\___/_//_/\_,_/_/ Please report bugs and contribute back your improvements
# /___/
# Version: v1.2.1
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / Copyright 2022 Tegonal Genossenschaft <[email protected]>
# \__/\__/\_, /\___/_//_/\_,_/_/ It is licensed under Creative Commons Zero v1.0 Universal
# /___/ Please report bugs and contribute back your improvements
#
# Version: v2.1.1
###################################
name: Cleanup

Expand Down
75 changes: 39 additions & 36 deletions .gt/remotes/tegonal-gh-commons/lib/src/gt/pull-hook-functions.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bash
#
# __ __
# / /____ ___ ____ ___ ___ _/ / This script is provided to you by https://github.com/tegonal/github-commons
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / It is licensed under Creative Commons Zero v1.0 Universal
# \__/\__/\_, /\___/_//_/\_,_/_/ Please report bugs and contribute back your improvements
# /___/
# Version: v1.2.1
# / /____ ___ ____ ___ ___ _/ / This file is provided to you by https://github.com/tegonal/github-commons
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / Copyright 2022 Tegonal Genossenschaft <[email protected]>
# \__/\__/\_, /\___/_//_/\_,_/_/ It is licensed under Creative Commons Zero v1.0 Universal
# /___/ Please report bugs and contribute back your improvements
#
# Version: v2.1.1
####### Description #############
#
# functions which can be used to update the placeholders in the templates in a gt pull-hook.sh
Expand All @@ -32,11 +32,9 @@
# 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"
#
# # also have a look at https://github.com/tegonal/gt/blob/main/.gt/remotes/tegonal-scripts/pull-hook.sh
# # replaces placeholders in all files github-commons provides with placeholders
# replaceTegonalGhCommonsPlaceholders "$source" "my-project-name" "$MY_PROJECT_LATEST_VERSION" \
# "MyCompanyName, Country" "[email protected]" "my-companies-github-name" "my-project-github-name"
#
###################################
set -euo pipefail
Expand All @@ -53,6 +51,37 @@ if ! [[ -v dir_of_tegonal_scripts ]]; then
source "$dir_of_tegonal_scripts/setup.sh" "$dir_of_tegonal_scripts"
fi

sourceOnce "$dir_of_tegonal_scripts/utility/parse-fn-args.sh"

function replaceTegonalGhCommonsPlaceholders(){
local source projectName version owner ownerEmail ownerGithubName projectNameGithub
# shellcheck disable=SC2034 # is passed to parseFnArgs by name
local -ra params=(source projectName version owner ownerEmail ownerGithubName projectNameGithub)
parseFnArgs params "$@"

if [[ $source =~ .*/\.github/CODE_OF_CONDUCT.md ]]; then
replacePlaceholdersCodeOfConduct "$source" "$ownerEmail"
elif [[ $source =~ .*/\.github/Contributor[[:space:]]Agreement\.txt ]]; then
replacePlaceholdersContributorsAgreement "$source" "$projectName" "$owner"
elif [[ $source =~ .*/\.github/PULL_REQUEST_TEMPLATE.md ]]; then
local -r githubUrl="https://github.com/$ownerGithubName/$projectNameGithub"
replacePlaceholdersPullRequestTemplate "$source" "$githubUrl" "$version"
fi
}

function replaceTegonalGhCommonsPlaceholders_Tegonal(){
local source projectName version projectNameGithub
# shellcheck disable=SC2034 # is passed to parseFnArgs by name
local -ra params=(source projectName version projectNameGithub)
parseFnArgs params "$@"


local tegonalFullName tegonalEmail tegonalGithubName
source "$dir_of_github_commons/gt/tegonal.data.source.sh" || die "could not source tegonal.data.source.sh"

replaceTegonalGhCommonsPlaceholders "$source" "$projectName" "$version" "$tegonalFullName" "$tegonalEmail" "$tegonalGithubName" "$projectNameGithub"
}

function replacePlaceholdersContributorsAgreement() {
if ! (($# == 3)); then
logError "you need to pass three arguments to replacePlaceholdersContributorsAgreement"
Expand All @@ -72,20 +101,6 @@ function replacePlaceholdersContributorsAgreement() {
"$file"
}

function replacePlaceholdersContributorsAgreement_Tegonal() {
if ! (($# == 2)); then
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
exit 9
fi
local -r file=$1
local -r projectName=$2
shift 2 || die "could not shift by 2"
replacePlaceholdersContributorsAgreement "$file" "$projectName" "Tegonal Genossenschaft, Switzerland"
}

function replacePlaceholdersPullRequestTemplate() {
if ! (($# == 3)); then
logError "you need to pass three arguments to replacePlaceholdersPullRequestTemplate"
Expand Down Expand Up @@ -121,18 +136,6 @@ function replacePlaceholdersCodeOfConduct(){
"$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
18 changes: 18 additions & 0 deletions .gt/remotes/tegonal-gh-commons/lib/src/gt/tegonal.data.source.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# shellcheck disable=SC2034,SC2168,SC2154
#
# __ __
# / /____ ___ ____ ___ ___ _/ / This script is provided to you by https://github.com/tegonal/github-commons
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / Copyright 2022 Tegonal Genossenschaft <[email protected]>
# \__/\__/\_, /\___/_//_/\_,_/_/ It is licensed under European Union Public License 1.2
# /___/ Please report bugs and contribute back your improvements
# Version: v2.1.1
####### Description #############
#
# constants intended to be sourced into a function.
#
###################################

local -r tegonalFullName="Tegonal Genossenschaft, Switzerland"
local -r tegonalEmail="[email protected]"
local -r tegonalGithubName="tegonal"
10 changes: 1 addition & 9 deletions .gt/remotes/tegonal-gh-commons/pull-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,7 @@ function gt_pullHook_tegonal_gh_commons_before() {
local -ra params=(_tag source _target)
parseFnArgs params "$@"

if [[ $source =~ .*/\.github/Contributor[[:space:]]Agreement\.txt ]]; then
replacePlaceholdersContributorsAgreement_Tegonal "$source" "tegonal-scripts"
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/scripts"
replacePlaceholdersPullRequestTemplate "$source" "$githubUrl" "$TEGONAL_SCRIPTS_LATEST_VERSION"
fi
replaceTegonalGhCommonsPlaceholders_Tegonal "$source" "tegonal-scripts" "$TEGONAL_SCRIPTS_LATEST_VERSION" "scripts"
}

function gt_pullHook_tegonal_gh_commons_after() {
Expand Down
21 changes: 11 additions & 10 deletions .gt/remotes/tegonal-gh-commons/pulled.tsv
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#@ Version: 1.0.0
tag file relativeTarget sha512
v1.2.1 src/.github/workflows/cleanup.yml ../.github/workflows/cleanup.yml a6b3bc1c60e45643c08f8c7da0b98c7933e6e0f9529b97c4b08fa36101b18dd02e639e1785dd9fe98de367b0292d1d95bc423afec8e6eadd843cdfa135579fbe
v1.2.1 src/.github/dependabot.yml ../.github/dependabot.yml 71af965b86944cf9fba10ce0457f8fb0f3e353ce89bfd8c1874d1a875f53c18bdec5e393012c932276b0ff659f9414440b5ff389d929ab9bd5256282c6b88caa
v1.2.1 src/.github/CODE_OF_CONDUCT.md ../.github/CODE_OF_CONDUCT.md b480c7b40a8d441628b54e3eee091fa9cd663bf7fada10b44f9676b9298b2ccf97578e6ddb4ac6639844c4008960a084bfa93d38c9fbcf58e4e5cb480455a654
v1.2.1 src/.github/PULL_REQUEST_TEMPLATE.md ../.github/PULL_REQUEST_TEMPLATE.md 9112d1ea1f72ea250cdfe686fc152e63f2e0cdcea9c46935289471d7a3f54c35af8a3f283570f5d863e936c7782939c7b1548cb7d4ccda712bbf9314926f58cb
v1.2.1 src/gt/pull-hook-functions.sh remotes/tegonal-gh-commons/lib/src/gt/pull-hook-functions.sh 84a45d712306af9db606fb0c270ac06a44f46dfd3658fb1e36312f5f18f27554feab075cfd64addef19712c86a715e348f1da86ab37bc03b8f2a6efcb6cc7828
v1.2.1 src/.github/Contributor Agreement.txt ../.github/Contributor Agreement.txt 8ae9a779436b7e3c1bb1ebc3317b5d53fca85acfd53ecdb9c22c7bc3ed063f01f8dad2e8cfc5dfea0bde47d61c09e6323f4b1510c96a2bc8ffacf0b572b0e6ab
v1.2.1 src/gt/signing-key.public.asc signing-key.public.asc f60d6119f8083da722199a90ffb61273d404ba74dd01fe6712d1d1157dd0037e9618eb99f1d7f85450508d25f2ea33f869ee04ef11206c7e420f02b27738ae9b
v1.2.1 src/gt/signing-key.public.asc.actual_sig signing-key.public.asc.actual_sig e854eb98125782f99bab8cf3663392f9e24c8d3c90911e7688152b13550981c47d8e79efbb540521163abcb4c16e33c8e1270a424655057bd224bb9b4dff329d
v1.2.1 src/dotfiles/.editorconfig ../.editorconfig d1d6f006a10fba0f0f6b4cb260d1b66be10bddcdc9518d67fce6355dc77afebbe6978e4338c764a0d7a9eb12fbebe920e050ec645fefae13d3550deaf72c0a69
v1.2.1 src/dotfiles/.shellcheckrc ../.shellcheckrc 8e0992e9fb39240bd9a85daa13cf7a22a4bf766b5851e06c9dae90d3015d54fb4e57a91255d3eae3d188437563e75d6d14f16037d3a2a32542edac5ce4b0c106
v2.1.1 src/.github/workflows/cleanup.yml ../.github/workflows/cleanup.yml 78d155430fced488506ab9207a728a2c269247d060ccb54e9505f721aac65e2612b1000dacd754fffe7e8e01be814ded3942e44727284aff76a5f549fe5ad26d
v2.1.1 src/.github/dependabot.yml ../.github/dependabot.yml 3d833307b03128d913255e92eddf97d7e3cdc6127ee170dbbd78a0bd1280ba8923f5c1f1560983d911178bb650d4e7d765d498bdf9581f973857c8c11666e232
v2.1.1 src/.github/CODE_OF_CONDUCT.md ../.github/CODE_OF_CONDUCT.md 4f072793ffe59b061319b4659248b974a1b03938ca1d73d3a9ddbe6820289848f7df2f08e6de566bc04d05876df97a99a364420af12528356e6529b44462e64b
v2.1.1 src/.github/PULL_REQUEST_TEMPLATE.md ../.github/PULL_REQUEST_TEMPLATE.md 9112d1ea1f72ea250cdfe686fc152e63f2e0cdcea9c46935289471d7a3f54c35af8a3f283570f5d863e936c7782939c7b1548cb7d4ccda712bbf9314926f58cb
v2.1.1 src/gt/pull-hook-functions.sh remotes/tegonal-gh-commons/lib/src/gt/pull-hook-functions.sh 934fa1421dfa2f7f267923801afa2330967099942786da38f504fff579d03938907932fa61d8c61c683e09278f7583257476ac573d833d5e15cea7a2a9dfc4f4
v2.1.1 src/.github/Contributor Agreement.txt ../.github/Contributor Agreement.txt 8ae9a779436b7e3c1bb1ebc3317b5d53fca85acfd53ecdb9c22c7bc3ed063f01f8dad2e8cfc5dfea0bde47d61c09e6323f4b1510c96a2bc8ffacf0b572b0e6ab
v2.1.1 src/gt/signing-key.public.asc signing-key.public.asc f60d6119f8083da722199a90ffb61273d404ba74dd01fe6712d1d1157dd0037e9618eb99f1d7f85450508d25f2ea33f869ee04ef11206c7e420f02b27738ae9b
v2.1.1 src/gt/signing-key.public.asc.actual_sig signing-key.public.asc.actual_sig e854eb98125782f99bab8cf3663392f9e24c8d3c90911e7688152b13550981c47d8e79efbb540521163abcb4c16e33c8e1270a424655057bd224bb9b4dff329d
v2.1.1 src/dotfiles/.editorconfig ../.editorconfig a1e9a814e40d6dd7a440b604ac1ef2a0e52d98fee545d27d31c98bdb15c615a15fc054d1ee74c7b6e2c3509a8d3212b9ad4ccc582ede62d30a9a220bd779ec17
v2.1.1 src/dotfiles/.shellcheckrc ../.shellcheckrc 1aa8f46f4f333f0b0789fe44dd43c5f257cec42a79d383744cbf511237ada077ee33210b19ce7e0c99895978b6b9a12498e1aca8ca2a3cca92aef9e4939d7aa4
v2.1.1 src/gt/tegonal.data.source.sh remotes/tegonal-gh-commons/lib/src/gt/tegonal.data.source.sh a629d768c8698e14d4e3dc16c783b555b6930883620d28e1c381b9ef02095a54baf9b2194ed9d3043f1ae806f722f11deb6d3a9f92ebd3ffb95ebe0f1aa139a2
8 changes: 4 additions & 4 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#
# __ __
# / /____ ___ ____ ___ ___ _/ / This file is provided to you by https://github.com/tegonal/github-commons
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / It is licensed under Creative Commons Zero v1.0 Universal
# \__/\__/\_, /\___/_//_/\_,_/_/ Please report bugs and contribute back your improvements
# /___/
# Version: v1.2.1
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / Copyright 2022 Tegonal Genossenschaft <[email protected]>
# \__/\__/\_, /\___/_//_/\_,_/_/ It is licensed under Creative Commons Zero v1.0 Universal
# /___/ Please report bugs and contribute back your improvements
#
# Version: v2.1.1
###################################

# Prefer putting braces around variable references even when not strictly required.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,7 @@ function foo() {
checkArgIsArrayWithTuples arr 3 "names" 1 describeTriple
exitIfArgIsNotArray arr 1
exitIfArgIsNotArrayOrIsEmpty arr 1
exitIfArgIsNotFunction "$fn" 2
# shellcheck disable=SC2317 # is passed by name to exitIfArgIsNotArrayWithTuples
Expand Down
7 changes: 7 additions & 0 deletions scripts/run-shellcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ function customRunShellcheck() {
)
local sourcePath="$dir_of_tegonal_scripts:$scriptsDir"
runShellcheck dirs "$sourcePath" -not -name "install-*.doc.sh"

local -r gh_commons_dir="$scriptsDir/../.gt/remotes/tegonal-gh-commons"
logInfo "analysing $gh_commons_dir/pull-hook.sh"

# shellcheck disable=SC2034 # is passed by name to runShellcheck
local -ra dirs2=("$gh_commons_dir")
runShellcheck dirs2 "$sourcePath" -name "pull-hook.sh"
}

${__SOURCED__:+return}
Expand Down

0 comments on commit 662aa83

Please sign in to comment.