Add Code Style Formatter Action for Python code in MyST markdown files with complete workflow setup #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Link Checker Action | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
test-good-links: | |
runs-on: ubuntu-latest | |
name: Test with good links only | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test action with good links | |
id: good-test | |
uses: .//.github/actions/link-checker | |
with: | |
html-path: './test/link-checker/good-links.html' | |
fail-on-broken: 'false' | |
ai-suggestions: 'true' | |
timeout: '10' | |
- name: Verify good results | |
run: | | |
echo "Broken links found: ${{ steps.good-test.outputs.broken-links-found }}" | |
echo "Broken link count: ${{ steps.good-test.outputs.broken-link-count }}" | |
if [ "${{ steps.good-test.outputs.broken-links-found }}" != "false" ]; then | |
echo "❌ Expected no broken links but found some" | |
exit 1 | |
fi | |
echo "✅ Good links test passed" | |
test-broken-links: | |
runs-on: ubuntu-latest | |
name: Test with broken links | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test action with broken links | |
id: broken-test | |
uses: .//.github/actions/link-checker | |
with: | |
html-path: './test/link-checker/broken-links.html' | |
fail-on-broken: 'false' | |
ai-suggestions: 'true' | |
silent-codes: '403,503' | |
timeout: '10' | |
- name: Verify broken results | |
run: | | |
echo "Broken links found: ${{ steps.broken-test.outputs.broken-links-found }}" | |
echo "Broken link count: ${{ steps.broken-test.outputs.broken-link-count }}" | |
echo "Redirect count: ${{ steps.broken-test.outputs.redirect-count }}" | |
echo "AI suggestions: ${{ steps.broken-test.outputs.ai-suggestions }}" | |
if [ "${{ steps.broken-test.outputs.broken-links-found }}" != "true" ]; then | |
echo "❌ Expected broken links but found none" | |
exit 1 | |
fi | |
if [ "${{ steps.broken-test.outputs.broken-link-count }}" -lt "2" ]; then | |
echo "❌ Expected at least 2 broken links but found ${{ steps.broken-test.outputs.broken-link-count }}" | |
exit 1 | |
fi | |
echo "✅ Broken links test passed" | |
test-redirect-links: | |
runs-on: ubuntu-latest | |
name: Test with redirect links and AI suggestions | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test action with redirect links | |
id: redirect-test | |
uses: .//.github/actions/link-checker | |
with: | |
html-path: './test/link-checker/redirect-links.html' | |
fail-on-broken: 'false' | |
ai-suggestions: 'true' | |
timeout: '10' | |
- name: Verify redirect results | |
run: | | |
echo "Broken links found: ${{ steps.redirect-test.outputs.broken-links-found }}" | |
echo "Redirect count: ${{ steps.redirect-test.outputs.redirect-count }}" | |
echo "AI suggestions: ${{ steps.redirect-test.outputs.ai-suggestions }}" | |
# Should find redirects | |
if [ "${{ steps.redirect-test.outputs.redirect-count }}" -lt "1" ]; then | |
echo "❌ Expected at least 1 redirect but found ${{ steps.redirect-test.outputs.redirect-count }}" | |
exit 1 | |
fi | |
# Should have AI suggestions | |
if [ -z "${{ steps.redirect-test.outputs.ai-suggestions }}" ]; then | |
echo "❌ Expected AI suggestions but found none" | |
exit 1 | |
fi | |
echo "✅ Redirect and AI suggestions test passed" | |
test-full-directory: | |
runs-on: ubuntu-latest | |
name: Test with full directory scan | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test action with full directory | |
id: directory-test | |
uses: .//.github/actions/link-checker | |
with: | |
html-path: './test/link-checker' | |
mode: 'full' | |
fail-on-broken: 'false' | |
ai-suggestions: 'true' | |
create-artifact: 'true' | |
artifact-name: 'test-link-report' | |
timeout: '10' | |
- name: Verify directory results | |
run: | | |
echo "Broken links found: ${{ steps.directory-test.outputs.broken-links-found }}" | |
echo "Broken link count: ${{ steps.directory-test.outputs.broken-link-count }}" | |
echo "Redirect count: ${{ steps.directory-test.outputs.redirect-count }}" | |
# Should find some broken links across all test files | |
if [ "${{ steps.directory-test.outputs.broken-links-found }}" != "true" ]; then | |
echo "❌ Expected broken links in directory scan but found none" | |
exit 1 | |
fi | |
if [ "${{ steps.directory-test.outputs.broken-link-count }}" -lt "2" ]; then | |
echo "❌ Expected at least 2 broken links in directory but found ${{ steps.directory-test.outputs.broken-link-count }}" | |
exit 1 | |
fi | |
echo "✅ Directory scan test passed" | |
test-fail-on-broken: | |
runs-on: ubuntu-latest | |
name: Test fail-on-broken functionality | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test that action fails when broken links found and fail-on-broken is true | |
id: fail-test | |
continue-on-error: true | |
uses: .//.github/actions/link-checker | |
with: | |
html-path: './test/link-checker/broken-links.html' | |
fail-on-broken: 'true' | |
timeout: '10' | |
- name: Verify action failed | |
run: | | |
if [ "${{ steps.fail-test.outcome }}" != "failure" ]; then | |
echo "❌ Expected action to fail but it succeeded" | |
exit 1 | |
fi | |
echo "✅ Fail-on-broken test passed" |