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

ci: expose base branch & narrow scope for md links #183

Merged
merged 4 commits into from
Oct 13, 2023
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
26 changes: 18 additions & 8 deletions .github/workflows/check-md-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ name: Check Markdown links
on:
workflow_call:
inputs:
base-branch:
description: "Default branch name"
required: true
type: string
default: "master"
config-file:
description: "Config file (JSON) used for markdown link checks"
required: false
Expand All @@ -13,11 +18,14 @@ on:
jobs:
markdown-link-check:
runs-on: ubuntu-20.04
env:
CONFIG_FILE: ${{ inputs.config-file }}
MODIFIED_ONLY: "no"
steps:
- uses: actions/checkout@master

- name: Create local version of config
if: inputs.config-file == ''
if: ${{ inputs.config-file == '' }}
run: |
echo '{
"ignorePatterns": [
Expand All @@ -34,16 +42,18 @@ jobs:
}
]
}' > 'markdown.links.config.json'
echo "CONFIG=markdown.links.config.json" >> $GITHUB_ENV
echo "CONFIG_FILE=markdown.links.config.json" >> $GITHUB_ENV
cat 'markdown.links.config.json'
- name: Show local version of config
if: inputs.config-file != ''
run: |
echo "CONFIG=${{ inputs.config-file }}" >> $GITHUB_ENV
cat ${{ inputs.config-file }}
- name: Show config
run: cat ${{ env.CONFIG_FILE }}

- name: narrow scope for PR
if: startsWith(github.event_name, 'pull_request')
run: echo "MODIFIED_ONLY=yes" >> $GITHUB_ENV
- name: Checking markdown link
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
base-branch: ${{ inputs.base-branch }}
use-quiet-mode: "yes"
config-file: ${{ env.CONFIG }}
check-modified-files-only: ${{ env.MODIFIED_ONLY }}
config-file: ${{ env.CONFIG_FILE }}
12 changes: 9 additions & 3 deletions .github/workflows/ci-use-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ jobs:
requirements-file: "requirements/dev-docs.txt"
install-tex: true

check-md-links:
check-md-links-default:
uses: ./.github/workflows/check-md-links.yml
#with:
# config-file: ".github/markdown.links.config.json"
with:
base-branch: main

check-md-links-w-config:
uses: ./.github/workflows/check-md-links.yml
with:
base-branch: main
config-file: ".github/markdown.links.config.json"
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- CI: allow Other targets for building docs ([#179](https://github.com/Lightning-AI/utilities/pull/179))


- CI: narrow scope for md links check ([#183](https://github.com/Lightning-AI/utilities/pull/183))


### Deprecated

- Deprecated `ModuleAvailableCache` in favor of `RequirementCache` ([#147](https://github.com/Lightning-AI/utilities/pull/147))
Expand All @@ -45,6 +48,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- CI: resolve latex dependency for docs builds ([181](https://github.com/Lightning-AI/utilities/pull/181))


- CI: fixed branch for md links check ([#183](https://github.com/Lightning-AI/utilities/pull/183))


## [0.9.0] - 2023-06-29

### Added
Expand Down
Loading