Skip to content

Files we use in multiple github repos and maintain here

License

Notifications You must be signed in to change notification settings

tegonal/github-commons

Repository files navigation

Download Creative Commons Zero v1.0 Universal Quality Assurance Newcomers Welcome

Tegonal's github-commons

This repository contains files we are (re-)using in our OSS work published on github.
Feel free to use them as well, they are licensed under Creative Commons Zero v1.0 Universal.
You might also be interested in our oss-template which uses them as well next to other files such as our bash scripts.

Table of Content

How to use it

In case you start a new open source project, then consider basing your repository on Tegonal's OSS-template. It has already setup github-commons as remote for gt and pulled several files. If you want to use it in an existing project, then we recommend you download Tegonal's OSS-template, initialise it as described in the readme and then copy the files you want to your existing repsoitory.

If the above does not sound like a plan, then we recommend you fetch the files you need of this repository via gt into our projects.
If you want to fetch them with gt as well, then set up a corresponding remote

gt remote add -r tegonal-gh-commons -u https://github.com/tegonal/github-commons

Now you can pull the files you want. For instance, to retrieve the dependabot.yml and put it into the .github directory:

gt pull -r tegonal-gh-commons -p src/.github/dependabot.yml --chop-path true -d .github

Placeholders

Some files contain placeholders which you should replace. We provide bash functions which you can source into your pull-hook.sh and use to fill the placeholders. Get them was well via gt:

gt pull -r tegonal-gh-commons -p src/gt/pull-hook-functions.sh

However, they require the utility functions of tegonal-scripts to be fetched alongside of github-commons. Thus, if you have not already pulled tegonal-scripts, then gt pull them.

And then in your pull-hook.sh you can use it as follows:

#!/usr/bin/env bash
set -euo pipefail
shopt -s inherit_errexit
MY_PROJECT_LATEST_VERSION="v1.0.0"

# Assumes tegonal's github-commons was fetched with gt and put into repoRoot/lib/tegonal-gh-commons/src
dir_of_github_commons="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/null && pwd 2>/dev/null)/../../../lib/tegonal-gh-commons/src"

if ! [[ -v dir_of_tegonal_scripts ]]; then
	dir_of_tegonal_scripts="$dir_of_github_commons/../../tegonal-scripts/src"
	source "$dir_of_tegonal_scripts/setup.sh" "$dir_of_tegonal_scripts"
fi

source "$dir_of_github_commons/gt/pull-hook-functions.sh"

declare _tag=$1 source=$2 _target=$3
shift 3 || die "could not shift by 3"

# 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"

Contributors and contribute

Our thanks go to code contributors as well as all other contributors (e.g. bug reporters, feature request creators etc.)

You are more than welcome to contribute as well:

Please have a look at CONTRIBUTING.md for further suggestions and guidelines.

Extend expiration of signing-key

Execute the following script, which will extend the sub-key 945FE615904E5C85 by one year and copies it to src/gt/signing-key.public.asc and also signs it again with the key 4B78012139378220 and finally copies the files to the .gt folder.

./scripts/extend-expiration-signing-key.sh

License

Most provided files are licensed under Creative Commons Zero v1.0 Universal.
Some files might be licensed under a different license, see header of the file.