Skip to content
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

Issue #89: Fix markdown check not working properly #111

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/workflow-build-container.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Reusable Docker Container Build

- **Purpose:** Build and push a Docker image to the Google Artifact Registry (GAR).
- **Usage:** Call this workflow and provide the `container-name` and `tag` as inputs.
- **Purpose:** Build and push a Docker image to the Google Artifact Registry
(GAR).
- **Usage:** Call this workflow and provide the `container-name` and `tag` as
inputs.
- **Required Secrets:**
- `GCP_CLOUDRUN_REGION`: Your Google Cloud Run region.
- `AILAB_GAR_JSON_KEY`: JSON key for authenticating with GAR.
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/workflow-build-push-container-azure.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Reusable workflow to build and push docker container to Azure Container Registry (ACR)

- **Purpose:** Build and push a docker container to Azure Container Registry (ACR).
- **Usage:** Call this workflow and provide the `container-name` and `tag` as inputs.
- **Purpose:** Build and push a docker container to Azure Container Registry
(ACR).
- **Usage:** Call this workflow and provide the `container-name` and `tag` as
inputs.
- **Required Secrets:**
- `ACR_SERVER`: The Azure container registry link.
- `ACR_USERNAME`: The Azure container registry username.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Reusable workflow to build and push docker container to GitHub Container Registry (GCR)
# Reusable workflow to build and push docker container to GitHub Container Registry (GHCR)

- **Purpose:** Build and push a docker container to GitHub Container Registry (GCR).
- **Purpose:** Build and push a docker container to GitHub Container Registry
(GCR).
- **Usage:** Call this workflow and provide the container-name, tag, and
registry as inputs. The registry should always start with
ghcr.io/<YOUR-REGISTRY-NAME> (e.g., ghcr.io/ai-cfia). If you create, push, or
merge a pull request, the workflow will be triggered and will start 2 jobs.
The first job will build and push the new image with 2 tags. The first tag is
the pull request number, and the second tag is the commit that triggered the
action. The second job will remove the previous image based on the previous
tag. If no Dockerfile is found
at the root of the repository, the workflow will be cancelled.
`ghcr.io/<YOUR-REGISTRY-NAME>` (e.g., ghcr.io/ai-cfia). If you create, push, or
merge a pull request, the workflow will be triggered and will start 2 jobs. The
first job will build and push the new image with 2 tags. The first tag is the
pull request number, and the second tag is the commit that triggered the action.
The second job will remove the previous image based on the previous tag. If no
Dockerfile is found at the root of the repository, the workflow will be
cancelled.
- **Required Secrets:**
- None
12 changes: 8 additions & 4 deletions .github/workflows/workflow-deploy-azure.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Reusable Docker Container Deployment to Azure

- **Purpose:** Deploy a Docker container to Azure App Service.
- **Usage:** Call this workflow and provide the `container-name` and `tag` as inputs.
- **Usage:** Call this workflow and provide the `container-name` and `tag` as
inputs.
- **Required Secrets:**
- `AZURE_CREDENTIALS`: JSON object containing Azure service principal credentials for authentication.
- `ACR_SERVER`: DNS to the Azure Container Registry where the Docker image is stored ex.: 'aciacfiaacr.azurecr.io'.
- `AZURE_CREDENTIALS`: JSON object containing Azure service principal
credentials for authentication.
- `ACR_SERVER`: DNS to the Azure Container Registry where the Docker image is
stored ex.: 'aciacfiaacr.azurecr.io'.
- `ACR_USERNAME`: Username for logging into Azure Container Registry.
- `ACR_PASSWORD`: Password for logging into Azure Container Registry.
- `AZURE_PUBLISH_PROFILE`: Publish profile for the Azure App Service. This contains deployment and configuration settings.
- `AZURE_PUBLISH_PROFILE`: Publish profile for the Azure App Service. This
contains deployment and configuration settings.
3 changes: 2 additions & 1 deletion .github/workflows/workflow-deploy-gcp.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Reusable Docker Container Deployment to Google Cloud Run

- **Purpose:** Deploy a Docker container to Google Cloud Run.
- **Usage:** Call this workflow and provide the `container-name` and `tag` as inputs.
- **Usage:** Call this workflow and provide the `container-name` and `tag` as
inputs.
- **Required Secrets:**
- `AILAB_GAR_JSON_KEY`: JSON key for authenticating with GAR.
- `GCP_CLOUDRUN_REGION`: Your Google Cloud Run region.
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/workflow-gh-pages-deployment.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Reusable Build and Deploy to GitHub Pages

- **Purpose:** Build a Node.js project and deploy the static assets to GitHub Pages.
- **Usage:** Call this workflow and provide `node-version`, `publish-dir`, `cache-dependency-path`, `working-dir` (optional, default is root), and `publish-branch` (optional, default is root) as inputs.
- **Purpose:** Build a Node.js project and deploy the static assets to GitHub
Pages.
- **Usage:** Call this workflow and provide `node-version`, `publish-dir`,
`cache-dependency-path`, `working-dir` (optional, default is root), and
`publish-branch` (optional, default is root) as inputs.
- **Required Secrets:**
- `GITHUB_TOKEN`: This token is automatically generated by GitHub to enable push access to the repository.
- `GITHUB_TOKEN`: This token is automatically generated by GitHub to enable
push access to the repository.
4 changes: 2 additions & 2 deletions .github/workflows/workflow-lint-and-apply-ansible.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ linting processes.
- **Note:** Provide an ansible-lint configuration file using the
`ansible-lint-config` input variable. Optionally, you can specify Python version
with the `python-version` input. Additionally, you may decrypt ansible variable
and inventory file by passing the name through the `ansible-variable-file`
and `ansible-inventory-file` inputs respectively.
and inventory file by passing the name through the `ansible-variable-file` and
`ansible-inventory-file` inputs respectively.
3 changes: 2 additions & 1 deletion .github/workflows/workflow-lint-test-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

- **Purpose:** Lint and test Node.js (React) projects.
- **Usage:** Call this workflow in your Node.js projects.
- **Note:** Ensure that your project has the necessary scripts for linting and testing in the `package.json` file.
- **Note:** Ensure that your project has the necessary scripts for linting and
testing in the `package.json` file.
31 changes: 23 additions & 8 deletions .github/workflows/workflow-markdown-check.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
# Reusable Workflow for Standardization Validation

- **Purpose:** Validate the organization's standards across projects.
- **Steps**
## Purpose

Validate the organization's standards across projects.

## Steps

1. Check for markdown dead links
2. Run markdown lint-test
- **Input:** You can specify specify a custom configuration file path for the
markdown link check. If you have specific rules or configurations for link
validation, you can create a configuration file in the project you are
calling this workflow from and input the path to this workflow. You can
find the documentation for this file
[here](https://github.com/tcort/markdown-link-check#config-file-format)

## Input

Markdown Link Config File Path (md-link-config-file-path): Optional. Specifies
the path to a custom configuration file for the markdown link validation. If
your project has specific rules or configurations for link validation
([example](https://github.com/ai-cfia/finesse-frontend/blob/main/.mlc_config.json)),
create a configuration file and input its path when calling this workflow. You
can refer to the documentation for the config file format
[here](https://github.com/tcort/markdown-link-check?tab=readme-ov-file#config-file-format).

Markdown Lint Config File Path (md-lint-config-file-path): Optional. Allows
specifying a path to a custom lint configuration file for markdown files. If not
provided, the workflow will use the default configuration file from the [current
repository](../../.markdownlint.json). You can refer to the documentation for
the config file format
[here](https://github.com/DavidAnson/markdownlint/).
47 changes: 39 additions & 8 deletions .github/workflows/workflow-markdown-check.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,62 @@
---
name: Check Markdown conformance to AI Lab standards

on:
workflow_call:
inputs:
config-file-path:
md-link-config-file-path:
required: false
type: string
md-lint-config-file-path:
required: false
type: string
push:

jobs:
markdown-link-check:
markdown-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

# Checkout reusable workflows repository for default configs if needed
- name: Checkout default configs
if: inputs.md-link-config-file-path == '' || inputs.md-lint-config-file-path == ''
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
repository: ai-cfia/github-workflows
path: github-workflows
ref: 89-fix-option-to-markdown-check-does-nothing-and-may-be-hiding-actual-errors
sparse-checkout: |
.markdownlint.json
.mlc_config.json
sparse-checkout-cone-mode: false

- name: Determine markdown link config file
id: linkconfig
run: |
if [ -z "${{ inputs.md-link-config-file-path }}" ]; then
echo "::set-output name=link_config_path::github-workflows/.mlc_config.json"
else
echo "::set-output name=link_config_path::${{ inputs.md-link-config-file-path }}"
fi

- name: Determine markdown lint config file
id: lintconfig
run: |
if [ -z "${{ inputs.md-lint-config-file-path }}" ]; then
echo "::set-output name=lint_config_path::github-workflows/.markdownlint.json"
else
echo "::set-output name=lint_config_path::${{ inputs.md-lint-config-file-path }}"
fi

- name: Validating links
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
config-file: '${{ inputs.config-file-path }}'
config-file: ${{ steps.linkconfig.outputs.link_config_path }}

- name: Run markdown lint
uses: DavidAnson/markdownlint-cli2-action@v14
with:
fix: true
# Run step even if previous steps fail.
if: always()
with:
globs: '**/*.md'
config: ${{ github.workspace }}/${{ steps.lintconfig.outputs.lint_config_path }}
4 changes: 2 additions & 2 deletions .github/workflows/workflow-terraform-check.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ various projects.
- **TFLint Check:** Runs TFLint to lint Terraform files, identifying potential
issues and deviations from best practices.
- **Input:** Optionally specify a custom configuration file path for TFLint to
use a specific set of rules.
use a specific set of rules.

## Terraform Linting Guidelines for Developers

Expand All @@ -34,4 +34,4 @@ set, you can create a `.tflint.hcl` file in your project's root directory.
Specify the path to this file when triggering the workflow to apply your custom
rules. The format and options for this configuration file are documented in the
[TFLint Configuration File Format]
(https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/config.md).
(<https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/config.md>).
12 changes: 8 additions & 4 deletions .github/workflows/workflow-vercel-deployment.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Vercel Preview Deployment

- **Purpose:** Deploy project artifacts to a Vercel preview environment and comment the deployment URL on the pull request for review.
- **Usage:** Trigger this workflow using `workflow_call`. You need to set `VERCEL_ORG_ID`, `VERCEL_PROJECT_ID` as secrets in your GitHub repository.
- **Purpose:** Deploy project artifacts to a Vercel preview environment and
comment the deployment URL on the pull request for review.
- **Usage:** Trigger this workflow using `workflow_call`. You need to set
`VERCEL_ORG_ID`, `VERCEL_PROJECT_ID` as secrets in your GitHub repository.
- **Required Secrets:**
- `VERCEL_TOKEN`: Token for authentication with Vercel, enables interaction with your Vercel account.
- `GITHUB_TOKEN`: Generated by GitHub to enable actions inside the repository, like commenting on pull requests.
- `VERCEL_TOKEN`: Token for authentication with Vercel, enables interaction
with your Vercel account.
- `GITHUB_TOKEN`: Generated by GitHub to enable actions inside the repository,
like commenting on pull requests.
18 changes: 11 additions & 7 deletions .github/workflows/workflow-yaml-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,21 @@ jobs:
.yamllint.yml
sparse-checkout-cone-mode: false

- name: Determine yaml lint config file
id: lintconfig
run: |
if [ -z "${{ inputs.config-file-path }}" ]; then
echo "::set-output name=lint_config_path::github-workflows/.yamllint.yml"
else
echo "::set-output name=lint_config_path::${{ inputs.config-file-path }}"
fi

- name: Lint YAML files
run: |
files=$(echo '${{ steps.files.outputs.all }}' | jq -r '.[]')
for file in $files; do
if [[ -f "$file" && ( $file == *.yml || $file == *.yaml ) ]]; then
# Check if a custom config path is provided and file exists
if [ -n "${{ github.event.inputs.config-file-path }}" ]; then
yamllint -c "${{ github.workspace }}/${{ github.event.inputs.config-file-path }}" "$file"
else
yamllint -c github-workflows/.yamllint.yml "$file"
fi
if [[ -f "$file" && ( $file == *.yml || $file == *.yaml ) ]]; then
yamllint -c "${{ github.workspace }}/${{ steps.lintconfig.outputs.lint_config_path }}" "$file"
fi
done
shell: bash
3 changes: 3 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"MD013": { "headings": false, "tables": false, "code_blocks": false}
}
3 changes: 3 additions & 0 deletions .mlc_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"aliveStatusCodes": [999,200,403]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Here are the available workflows and their associated documentation:
Pages](.github/workflows/workflow-gh-pages-deployment.md)
- [Reusable Vercel
Deployment](.github/workflows/workflow-vercel-deployment.md)
- [Reusable Build
- [Reusable Build
and Push to GCR](.github/workflows/workflow-build-push-container-github-registry.md)

## Usage
Expand Down
Loading