From 9cb72b3ae3272dc86c8601b381d8886d67125d35 Mon Sep 17 00:00:00 2001 From: Gil Arasa Verge Date: Fri, 26 Mar 2021 18:13:25 +0100 Subject: [PATCH] Warn first time contributors to add themselves to the CONTRIBUTORS file --- .github/ISSUE_TEMPLATE/config.yml | 4 ++-- .github/ISSUE_TEMPLATE/custom.md | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 6 +++--- githooks/pre-commit | 2 +- githooks/pre-commit-add-contributor | 13 +++++++++++++ 5 files changed, 20 insertions(+), 7 deletions(-) create mode 100755 githooks/pre-commit-add-contributor diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index fd1ec77bd..41f18c3c1 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,7 +1,7 @@ blank_issues_enabled: false contact_links: - - name: Want to Discuss something? + - name: Discussions url: https://github.com/metacall/core/discussions - about: For any Discussion, Queestions or Query + about: This is where long discussions could take place outside of the chat platforms. diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md index f97bd0af1..841a03f18 100644 --- a/.github/ISSUE_TEMPLATE/custom.md +++ b/.github/ISSUE_TEMPLATE/custom.md @@ -12,7 +12,7 @@ Our project, as you've probably heard, is getting really popular and truth is we Do the checklist before filing an issue: - [ ] Is this something you can **debug and fix**? Create an apt issue and send us a pull request! Bug fixes and documentation fixes are welcome. -- [ ] Have a usage question? Ask your question on [Discussions](https://github.com/metacall/core/discussions/new). We use Github Discussions for usage question and GitHub for bugs. +- [ ] Have an usage question? Ask it on [Discussions](https://github.com/metacall/core/discussions/new) or community chats. We use Github Discussions for usage questions and GitHub Issues for bugs. - [ ] Have an idea for a feature? Use the feature issue and propose your ideas. None of the above, create a custom issue diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index cdb2815a2..35955a908 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -14,18 +14,18 @@ Fixes #(issue_no) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update -- [ ] Documentation Update +- [ ] Documentation update # Checklist: -- [ ] My code follows the style guidelines (Clean Code) of this project. +- [ ] My code follows the style guidelines (clang-format) of this project. - [ ] I have performed a self-review of my own code. - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have made corresponding changes to the documentation. - [ ] My changes generate no new warnings. - [ ] I have added tests/screenshots (if any) that prove my fix is effective or that my feature works. - [ ] I have tested my code with `OPTION_BUILD_SANITIZER` and `OPTION_TEST_MEMORYCHECK`. -- [ ] I have tested with `Helgrind` in case my code works with threading. +- [ ] I have tested with `Helgrind` in case my code works with threading. If you are unclear about any of the above checks, have a look at our documentation [here](https://github.com/metacall/core/blob/develop/docs/README.md#63-debugging) diff --git a/githooks/pre-commit b/githooks/pre-commit index fc50ed70e..5afa02a1b 100755 --- a/githooks/pre-commit +++ b/githooks/pre-commit @@ -14,7 +14,7 @@ # as this script. Hooks should return 0 if successful and nonzero to cancel the # commit. They are executed in the order in which they are listed. #HOOKS="pre-commit-compile pre-commit-uncrustify" -HOOKS="pre-commit-clang-format" +HOOKS="pre-commit-add-contributor pre-commit-clang-format" ########################################################### # There should be no need to change anything below this line. diff --git a/githooks/pre-commit-add-contributor b/githooks/pre-commit-add-contributor new file mode 100755 index 000000000..783e9e480 --- /dev/null +++ b/githooks/pre-commit-add-contributor @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +if git log --pretty="%ae%n%ce" | sort | uniq | grep -q "$(git config user.email)"; then + exit 0 +else + if git log --pretty="%an%n%cn" | sort | uniq | grep -q "$(git config user.name)"; then + exit 0 + else + printf "Please add yourself (copy the next line) to the CONTRIBUTORS.md file.\n"; + printf '%s <%s>\n\n' "$(git config user.name)" "$(git config user.email)"; + exit 1 + fi +fi