-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add markdown link checking #1713
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: PR check Markdown links | ||
|
||
# Only run this workflow on PRs | ||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
|
||
# Disable permissions for all available scopes for the GITHUB_TOKEN | ||
# except for the metadata scope. | ||
permissions: {} | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
pr-markdown-link-check: | ||
# Only run the job on non-draft PRs | ||
if: "github.event.pull_request.draft == false" | ||
name: Check PR Markdown links | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code under the $GITHUB_WORKSPACE directory | ||
uses: actions/checkout@v3 | ||
- name: Check markdown links | ||
uses: gaurav-nelson/[email protected] | ||
with: | ||
use-quiet-mode: 'no' | ||
use-verbose-mode: 'yes' | ||
config-file: './.markdown-link-check/markdown-link-check-config.json' | ||
check-modified-files-only: 'no' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is intentional: All the specified md files and directories in the workflows are |
||
file-extension: '.md' | ||
# Unfortunately there's currently not a way to ignore specific | ||
# directories/paths in the GitHub action so we need to specify | ||
# the desired set of directories/paths that we want to check | ||
# in order to avoid checking undesired directories/paths | ||
folder-path: './docs, ./pkg, ./templates, ./.github, ./cmd, ./internal, ./openapi, ./docker, ./scripts' | ||
file-path: './README.md, ./CONTRIBUTING.md' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Weekly check Markdown links | ||
|
||
# Run this workflow every Monday at 07:00 UTC | ||
on: | ||
schedule: | ||
- cron: "0 7 * * 1" | ||
|
||
# Disable permissions for all available scopes for the GITHUB_TOKEN | ||
# except for the metadata scope. | ||
permissions: {} | ||
|
||
jobs: | ||
weekly-markdown-link-check: | ||
name: Weekly Check Markdown links | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code under the $GITHUB_WORKSPACE directory | ||
uses: actions/checkout@v3 | ||
- name: Check markdown links | ||
uses: gaurav-nelson/[email protected] | ||
with: | ||
use-quiet-mode: 'no' | ||
use-verbose-mode: 'yes' | ||
config-file: './.markdown-link-check/markdown-link-check-config.json' | ||
check-modified-files-only: 'no' | ||
file-extension: '.md' | ||
# Unfortunately there's currently not a way to ignore specific | ||
# directories/paths in the GitHub action so we need to specify | ||
# the desired set of directories/paths that we want to check | ||
# in order to avoid checking undesired directories/paths | ||
folder-path: './docs, ./pkg, ./templates, ./.github, ./cmd, ./internal, ./openapi, ./docker, ./scripts' | ||
file-path: './README.md, ./CONTRIBUTING.md' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"ignorePatterns": [ | ||
{ | ||
"pattern": "^https://gitlab.cee.redhat.com" | ||
}, | ||
{ | ||
"pattern": "^https://github.com/bf2fc6cc711aee1a0c2a/observability-resources-mk" | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,6 +161,22 @@ ifeq (, $(shell which ${LOCAL_BIN_PATH}/rhoasapi-installation/spectral 2> /dev/n | |
} | ||
endif | ||
|
||
MARKDOWN_LINK_CHECK ?= ${LOCAL_BIN_PATH}/markdown-link-check | ||
markdown-link-check-install: | ||
ifeq (, $(shell which ${NPM} 2> /dev/null)) | ||
@echo "npm is not available please install it to be able to install markdown-link-check" | ||
exit 1 | ||
endif | ||
ifeq (, $(shell which ${LOCAL_BIN_PATH}/markdown-link-check 2> /dev/null)) | ||
@{ \ | ||
set -e ;\ | ||
mkdir -p ${LOCAL_BIN_PATH} ;\ | ||
mkdir -p ${LOCAL_BIN_PATH}/markdown-link-check-installation ;\ | ||
cd ${LOCAL_BIN_PATH} ;\ | ||
${NPM} install --prefix ${LOCAL_BIN_PATH}/markdown-link-check-installation [email protected] ;\ | ||
ln -s markdown-link-check-installation/node_modules/.bin/markdown-link-check markdown-link-check ;\ | ||
} | ||
endif | ||
|
||
.PHONY: openapi/spec/validate | ||
openapi/spec/validate: specinstall | ||
|
@@ -177,6 +193,7 @@ help: | |
@echo "" | ||
@echo "make verify verify source code" | ||
@echo "make lint lint go files and .yaml templates" | ||
@echo "make lint/markdown-link-check check for broken links in markdown files" | ||
@echo "make binary compile binaries" | ||
@echo "make install compile binaries and install in GOPATH bin" | ||
@echo "make run run the application" | ||
|
@@ -263,6 +280,10 @@ lint/templates: specinstall | |
$(SPECTRAL) lint templates/*.yml templates/*.yaml --ignore-unknown-format --ruleset .validate-templates.yaml | ||
.PHONY: lint/templates | ||
|
||
MARKDOWN_LINK_CHECK_CONFIG_DIR ?= $(PROJECT_PATH)/.markdown-link-check | ||
MARKDOWN_LINK_CHECK_CONFIG ?= $(MARKDOWN_LINK_CHECK_CONFIG_DIR)/markdown-link-check-config.json | ||
lint/markdown-link-check: markdown-link-check-install | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This hasn't been added to the |
||
find $(PROJECT_PATH) -type f -not -path '$(PROJECT_PATH)/bin*' -name '*.md' -exec $(MARKDOWN_LINK_CHECK) -q -c $(MARKDOWN_LINK_CHECK_CONFIG) {} \; | ||
|
||
# Runs linter against go files and .y(a)ml files in the templates directory | ||
# Requires golangci-lint to be installed @ $(go env GOPATH)/bin/golangci-lint | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
# Adding a new Config Module | ||
This document covers the steps on how to add a new config module to the service. | ||
|
||
1. Add an example configuration file in the /config folder. Ensure that the parameters are documented, see [provider-configuration.yaml](/config/provider-configuration.yaml) as example. | ||
1. Add an example configuration file in the /config folder. Ensure that the parameters are documented, see [provider-configuration.yaml](../config/provider-configuration.yaml) as example. | ||
|
||
2. Create a new config file with a filename format of `<config>.go` (see [kafka.go](../internal/kafka/internal/config/kafka.go) as an example). | ||
> **NOTE**: If this configuration is an extension of an already existing configuration, please prefix the filename with the name of the config module its extending i.e. [kafka_supported_sizes.go](../internal/kafka/internal/config/kafka_supported_sizes.go) is an extension of the [kafka.go](../internal/kafka/internal/config/kafka.go) config. | ||
> **NOTE**: If this configuration is an extension of an already existing configuration, please prefix the filename with the name of the config module its extending i.e. [kafka_supported_instance_types.go](../internal/kafka/internal/config/kafka_supported_instance_types.go) is an extension of the [kafka.go](../internal/kafka/internal/config/kafka.go) config. | ||
|
||
These files should be created in the following places based on usage : | ||
- `/pkg/...` - If it's a common configuration that can be shared across all services | ||
- `/internal/kafka/internal/config` - for any Kafka specific configuration | ||
- `/internal/connector/internal/config` - for any Connector specific configuration | ||
|
||
3. The new config file has to implement the `ConfigModule` [interface](/pkg/environments/interfaces.go). This should be added into one of the following providers file: | ||
3. The new config file has to implement the `ConfigModule` [interface](../pkg/environments/interfaces.go). This should be added into one of the following providers file: | ||
- `CoreConfigProviders()` inside the [core providers file](../pkg/providers/core.go): For any global configuration that is not specific to a particular service (i.e. kafka or connector). | ||
- `ConfigProviders()` inside [kafka providers](../internal/kafka/providers.go): For any kafka specific configuration. | ||
- `ConfigProviders()` inside [connector providers](../internal/connector/providers.go): For any connector specific configuration. | ||
> **NOTE**: If your ConfigModule also implements the ServiceValidator [interface](/pkg/environments/interfaces.go), please ensure to also specify `di.As(new(environments2.ServiceValidator))` when providing the dependency in one of the ConfigProviders listed above. Otherwise, the validation for your configuration will not be called. | ||
> **NOTE**: If your ConfigModule also implements the ServiceValidator [interface](../pkg/environments/interfaces.go), please ensure to also specify `di.As(new(environments2.ServiceValidator))` when providing the dependency in one of the ConfigProviders listed above. Otherwise, the validation for your configuration will not be called. | ||
|
||
4. Create/edit tests for the configuration file if needed with a filename format of `<config_test>.go` in the same directory the config file was created. | ||
4. Create/edit tests for the configuration file if needed with a filename format of `<config_test>.go` in the same directory the config file was created. | ||
|
||
5. Ensure the [service-template](../templates/service-template.yml) is updated. See this [pr](https://github.com/bf2fc6cc711aee1a0c2a/kas-fleet-manager/pull/817) as an example. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separating this into its own workflow is intentional. The reason for it is that we want to take advantage of parallelism and restrict the set of events that are considered.
The same applies to the workflow for the periodic execution