Skip to content

Commit

Permalink
Fetch org readme template
Browse files Browse the repository at this point in the history
  • Loading branch information
osterman committed Jan 25, 2024
1 parent 896b366 commit 14d8a00
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 402 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.project
build-harness.iml
build-harness
templates/README.md.gotmpl
14 changes: 13 additions & 1 deletion modules/readme/Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
export README_LINT ?= $(TMP)/README.md
export README_FILE ?= README.md
export README_YAML ?= README.yaml

export README_TEMPLATE_REPO_REMOTE_NAME ?= origin
export README_TEMPLATE_REPO_ORG ?= $(lastword $(subst :, ,$(subst /,,$(dir $(shell git remote get-url $(README_TEMPLATE_REPO_REMOTE_NAME))))))
export README_TEMPLATE_REPO ?= .github
export README_TEMPLATE_REPO_REF ?= blob/add-readme-md-tmpl
export README_TEMPLATE_REPO_PATH ?= README.md.gotmpl
export README_TEMPLATE_REPO_URL ?= https://github.com/$(README_TEMPLATE_REPO_ORG)/$(README_TEMPLATE_REPO)/$(README_TEMPLATE_REPO_REF)/$(README_TEMPLATE_REPO_PATH)?raw=true
export README_TEMPLATE_FILE ?= $(BUILD_HARNESS_PATH)/templates/README.md.gotmpl
export README_TEMPLATE_YAML := $(if $(findstring http,$(README_YAML)),$(README_YAML),$(BUILD_HARNESS_PATH)/templates/$(README_YAML))
export README_INCLUDES ?= $(file://$(shell pwd)/?type=text/plain)

# Create the README.md.gotmpl, if none exists by fetching it from the organization's `.github` repository
$(README_TEMPLATE_FILE):
@echo GitHub Org: $(README_TEMPLATE_REPO_ORG)
curl -o $@ -fsSL '$(README_TEMPLATE_REPO_URL)'

## Alias for readme/build
readme: readme/build
@exit 0

readme/deps: packages/install/gomplate
readme/deps: packages/install/gomplate $(README_TEMPLATE_FILE)
@exit 0

## Create basic minimalistic .README.md template file
Expand Down
Loading

0 comments on commit 14d8a00

Please sign in to comment.