-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split up makefiles, ensure templates are copied
- Loading branch information
Showing
5 changed files
with
126 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,20 @@ | ||
.PHONY: help setup-workflows-dir configure-spell-check configure-commit-lint configure-label-lint configure-link-check configure-secret-scan remove-spell-check remove-commit-lint remove-label-lint remove-link-check remove-secret-scan remove-all configure-all | ||
|
||
setup-workflows-dir: | ||
@if [ ! -d "../.github/workflows" ]; then mkdir -p ../.github/workflows; fi | ||
include make/gh-templates.mk | ||
include make/gh-automation.mk | ||
|
||
configure-spell-check: setup-workflows-dir | ||
@if [ -f "../.github/workflows/spell-check.yaml" ]; then echo "ERROR: .github/workflows/spell-check.yaml already exists"; exit 1; fi | ||
@if [ -f "../cspell.json" ]; then echo "ERROR: cspell.json already exists"; exit 1; fi | ||
ln .github/workflows/spell-check.yaml ../.github/workflows/spell-check.yaml | ||
ln cspell.json ../cspell.json | ||
@echo "Spell checking configured to use Swiss Army Knife!" | ||
help: ## Display this help information. Use 'make help <prefix>' to filter targets | ||
@if [ "$(filter-out help,$(MAKECMDGOALS))" ]; then \ | ||
awk 'BEGIN {FS = ":.*##"; printf "\033[36m%-30s\033[0m %s\n", "Target", "Description"} \ | ||
/^$(filter-out help,$(MAKECMDGOALS))[a-zA-Z0-9_-]*:.*?##/ { printf "\033[36m%-30s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST); \ | ||
else \ | ||
awk 'BEGIN {FS = ":.*##"; printf "\033[36m%-30s\033[0m %s\n", "Target", "Description"} \ | ||
/^[a-zA-Z0-9_-]+:.*?##/ { printf "\033[36m%-30s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST); \ | ||
fi | ||
|
||
configure-commit-lint: setup-workflows-dir | ||
@if [ -f "../.github/workflows/commit-lint.yaml" ]; then echo "ERROR: .github/workflows/commit-lint.yaml already exists"; exit 1; fi | ||
@if [ -f "../commitlint.config.js" ]; then echo "ERROR: commitlint.config.js already exists"; exit 1; fi | ||
ln .github/workflows/commit-lint.yaml ../.github/workflows/commit-lint.yaml | ||
ln commitlint.config.js ../commitlint.config.js | ||
@echo "Commit linting configured to use Swiss Army Knife!" | ||
%: # Catch-all rule to allow additional arguments | ||
@: | ||
|
||
configure-label-lint: setup-workflows-dir | ||
@if [ -f "../.github/workflows/label-lint.yaml" ]; then echo "ERROR: .github/workflows/label-lint.yaml already exists"; exit 1; fi | ||
ln .github/workflows/label-lint.yaml ../.github/workflows/label-lint.yaml | ||
@echo "Label linting configured to use Swiss Army Knife!" | ||
install: templates-install workflows-install ## Installs all of the artifacts contained in Swiss Army Knife | ||
|
||
configure-link-check: setup-workflows-dir | ||
@if [ -f "../.github/workflows/link-check.yaml" ]; then echo "ERROR: .github/workflows/link-check.yaml already exists"; exit 1; fi | ||
@if [ -f "../.lycheeignore" ]; then echo "ERROR: .lycheeignore already exists"; exit 1; fi | ||
ln .github/workflows/link-check.yaml ../.github/workflows/link-check.yaml | ||
ln .lycheeignore ../.lycheeignore | ||
@echo "Link checking configured to use Swiss Army Knife!" | ||
|
||
configure-secret-scan: setup-workflows-dir | ||
@if [ -f "../.github/workflows/secret-scan.yaml" ]; then echo "ERROR: .github/workflows/secret-scan.yaml already exists"; exit 1; fi | ||
ln .github/workflows/secret-scan.yaml ../.github/workflows/secret-scan.yaml | ||
@echo "Secret scanning configured to use Swiss Army Knife!" | ||
|
||
remove-spell-check: | ||
@if [ -f "../.github/workflows/spell-check.yaml" ]; then rm ../.github/workflows/spell-check.yaml; fi | ||
@if [ -f "../cspell.json" ]; then rm ../cspell.json; fi | ||
@echo "Spell checking removed!" | ||
|
||
remove-commit-lint: | ||
@if [ -f "../.github/workflows/commit-lint.yaml" ]; then rm ../.github/workflows/commit-lint.yaml; fi | ||
@if [ -f "../commitlint.config.js" ]; then rm ../commitlint.config.js; fi | ||
@echo "Commit linting removed!" | ||
|
||
remove-label-lint: | ||
@if [ -f "../.github/workflows/label-lint.yaml" ]; then rm ../.github/workflows/label-lint.yaml; fi | ||
@echo "Label linting removed!" | ||
|
||
remove-link-check: | ||
@if [ -f "../.github/workflows/link-check.yaml" ]; then rm ../.github/workflows/link-check.yaml; fi | ||
@if [ -f "../.lycheeignore" ]; then rm ../.lycheeignore; fi | ||
@echo "Link checking removed!" | ||
|
||
remove-secret-scan: | ||
@if [ -f "../.github/workflows/secret-scan.yaml" ]; then rm ../.github/workflows/secret-scan.yaml; fi | ||
@echo "Secret scanning removed!" | ||
|
||
remove-all: remove-spell-check remove-commit-lint remove-label-lint remove-link-check remove-secret-scan | ||
@echo "All configurations have been removed!" | ||
|
||
configure-all: configure-spell-check configure-commit-lint configure-label-lint configure-link-check configure-secret-scan | ||
@echo "All configurations have been set up to use Swiss Army Knife!" | ||
remove: templates-remove workflows-remove ## UNSAFE: Removes all of the artifacts contained in Swiss Army Knife |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Project Management | ||
|
||
## Issue Templates | ||
|
||
To ensure consistency and clarity when creating new issues, you can use issue templates. These templates help guide contributors to provide the necessary information, making it easier to triage and address issues. | ||
|
||
Examples you can use in your project are provided here: | ||
|
||
```bash | ||
. | ||
└── .github | ||
└── ISSUE_TEMPLATE | ||
├── bug_report.md | ||
├── chore.md | ||
└── feature_request.md | ||
``` | ||
|
||
## Pull Request Template | ||
|
||
To standardize and streamline the pull request process, you can create a pull request template. This template will automatically populate the description field when a new pull request is created, ensuring that all necessary information is provided. | ||
|
||
An example you can use for your project is provided here: | ||
|
||
```bash | ||
. | ||
└── .github | ||
└── PULL_REQUEST_TEMPLATE | ||
└── pull_request_template.yaml | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
WORKFLOWS := commit-lint.yaml label-lint.yaml link-check.yaml secret-scan.yaml spell-check.yaml | ||
CONFIG_FILES := .lycheeignore commitlint.config.js cspell.json | ||
|
||
SOURCE_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../) | ||
SOURCE_WORKFLOWS_DIR := $(SOURCE_DIR)/.github/workflows | ||
TARGET_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../../) | ||
TARGET_WORKFLOWS_DIR := $(TARGET_DIR)/.github/workflows | ||
|
||
.PHONY: .setup-workflows-dir .remove-workflows-dir | ||
|
||
.setup-workflows-dir: | ||
@if [ ! -d "$(TARGET_WORKFLOWS_DIR)" ]; then mkdir -p $(TARGET_WORKFLOWS_DIR); fi | ||
|
||
.remove-workflows-dir: | ||
@if [ -d "$(TARGET_WORKFLOWS_DIR)" ]; then rm -rf $(TARGET_WORKFLOWS_DIR); fi | ||
|
||
.remove-workflows-config: | ||
@for config in $(CONFIG_FILES); do \ | ||
if [ -f "$(TARGET_DIR)/$$config" ]; then rm $(TARGET_DIR)/$$config; fi; \ | ||
done | ||
|
||
workflows-install: .setup-workflows-dir ## Installs the GitHub workflows | ||
@echo "Installing workflows" | ||
@for workflow in $(WORKFLOWS); do \ | ||
ln $(SOURCE_WORKFLOWS_DIR)/$$workflow $(TARGET_WORKFLOWS_DIR)/$$workflow; \ | ||
done | ||
@for config in $(CONFIG_FILES); do \ | ||
ln $(SOURCE_DIR)/$$config $(TARGET_DIR)/$$config; \ | ||
done | ||
@echo "GitHub workflows installed at: $(TARGET_WORKFLOWS_DIR)" | ||
@echo "Workflows: $(WORKFLOWS)" | ||
@echo "Config files installed at: $(TARGET_DIR)" | ||
@echo "Config files: $(CONFIG_FILES)" | ||
@echo "GitHub workflows installed!" | ||
|
||
workflows-remove: .remove-workflows-dir .remove-workflows-config ## UNSAFE: Removes the GitHub workflows directory | ||
@echo "Removed workflows directory: $(TARGET_WORKFLOWS_DIR)" | ||
@echo "Removed workflows: $(WORKFLOWS)" | ||
@echo "Removed config files: $(CONFIG_FILES)" | ||
@echo "GitHub workflows removed!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
ISSUE_TEMPLATES := bug_report.md feature_request.md chore.md | ||
PR_TEMPLATE := pull_request_template.md | ||
SOURCE_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../.github/) | ||
SOURCE_ISSUE_TEMPLATE_DIR := $(SOURCE_DIR)/ISSUE_TEMPLATE | ||
SOURCE_PR_TEMPLATE_DIR := $(SOURCE_DIR)/PULL_REQUEST_TEMPLATE | ||
TARGET_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../../.github/) | ||
TARGET_ISSUE_TEMPLATE_DIR := $(TARGET_DIR)/ISSUE_TEMPLATE | ||
TARGET_PR_TEMPLATE_DIR := $(TARGET_DIR)/PULL_REQUEST_TEMPLATE | ||
|
||
.PHONY: templates-install templates-remove .setup-templates-dir .remove-templates-dir | ||
|
||
.setup-templates-dir: | ||
@if [ ! -d "$(TARGET_ISSUE_TEMPLATE_DIR)" ]; then mkdir -p $(TARGET_ISSUE_TEMPLATE_DIR); fi | ||
@if [ ! -d "$(TARGET_PR_TEMPLATE_DIR)" ]; then mkdir -p $(TARGET_PR_TEMPLATE_DIR); fi | ||
|
||
.remove-templates-dir: | ||
@if [ -d "$(TARGET_ISSUE_TEMPLATE_DIR)" ]; then rm -rf $(TARGET_ISSUE_TEMPLATE_DIR); fi | ||
@if [ -d "$(TARGET_PR_TEMPLATE_DIR)" ]; then rm -rf $(TARGET_PR_TEMPLATE_DIR); fi | ||
|
||
templates-install: .setup-templates-dir ## Installs the GitHub issue and PR templates | ||
@echo "Installing templates" | ||
@for template in $(ISSUE_TEMPLATES); do \ | ||
ln $(SOURCE_ISSUE_TEMPLATE_DIR)/$$template $(TARGET_ISSUE_TEMPLATE_DIR)/$$template; \ | ||
done | ||
@ln $(SOURCE_PR_TEMPLATE_DIR)/$(PR_TEMPLATE) $(TARGET_PR_TEMPLATE_DIR)/$(PR_TEMPLATE) | ||
@echo "GitHub issue templates installed at: $(TARGET_ISSUE_TEMPLATE_DIR)" | ||
@echo "Issue templates: $(ISSUE_TEMPLATES)" | ||
@echo "GitHub PR template installed at: $(TARGET_PR_TEMPLATE_DIR)" | ||
@echo "PR template: $(PR_TEMPLATE)" | ||
@echo "Issue and PR templates installed!" | ||
|
||
templates-remove: .remove-templates-dir ## UNSAFE: Removes the GitHub issue and PR templates directories | ||
@echo "Removed issue templates directory: $(TARGET_ISSUE_TEMPLATE_DIR)" | ||
@echo "Removed issue templates: $(ISSUE_TEMPLATES)" | ||
@echo "Removed PR template directory: $(TARGET_PR_TEMPLATE_DIR)" | ||
@echo "Removed PR template: $(PR_TEMPLATE)" | ||
@echo "GitHub issue and PR templates removed!" |