Skip to content

tegonal-bot/github-commons

 
 

Repository files navigation

Download Creative Commons Zero v1.0 Universal Code Quality 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.
(Take also a look at our bash scripts which are licensed under Apache 2.0)

Table of Content

How to use it

Typically, we fetch the files of this repository via gget into our projects.
If you want to fetch them with gget as well then set up a corresponding remote

gget 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 .github

gget 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 those. Get them was well via gget

gget pull -r tegonal-gh-commons -p src/gget/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 gget 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 gget - adjust location accordingly
dir_of_github_commons="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/null && pwd 2>/dev/null)/../lib/tegonal-gh-common/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/gget/pull-hook-functions.sh"

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"

# also have a look at https://github.com/tegonal/gget/blob/main/.gget/remotes/tegonal-scripts/pull-hook.sh

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:

License

The provided scripts are licensed under Creative Commons Zero v1.0 Universal.

About

Files we use in multiple github repos and maintain here

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%