Skip to content

Commit

Permalink
ci: expose base branch & narrow scope for md links (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda authored Oct 13, 2023
1 parent 8237cb5 commit 90da931
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 11 deletions.
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

0 comments on commit 90da931

Please sign in to comment.