Skip to content
Open
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
82 changes: 82 additions & 0 deletions .github/workflows/links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Links

on:
repository_dispatch:
workflow_dispatch:
pull_request:
schedule:
- cron: "00 18 * * *"

jobs:
linkChecker:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
linkChecker:
check-links:

for consistency

runs-on: ubuntu-latest
permissions:
issues: write # required for peter-evans/create-issue-from-file
pull-requests: write # required for github-script to comment on PRs
steps:
- uses: actions/checkout@v5

- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v2
with:
args: . --exclude-path "tests"
fail: false

# - name: Create or Update PR Comment
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBD

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probbaly use it to create an issue instead of a PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, let's start with an issue

# if: steps.lychee.outputs.exit_code != 0 && github.event_name == 'pull_request'
# uses: actions/github-script@v8
# with:
# script: |
# const fs = require('fs');
# const commentMarker = '<!-- link-checker-report -->';

# // Read the report file if it exists, otherwise use a fallback message
# let body;
# if (fs.existsSync('./lychee/out.md')) {
# body = fs.readFileSync('./lychee/out.md', 'utf8');
# } else {
# body = '## 🔗 Link Checker Report\n\nThe link checker found broken links in this pull request. Please check the workflow logs for details.';
# }

# // Add the marker to identify this comment
# body = commentMarker + '\n\n' + body;

# // Get existing comments on the PR
# const { data: comments } = await github.rest.issues.listComments({
# owner: context.repo.owner,
# repo: context.repo.repo,
# issue_number: context.issue.number,
# });

# // Find existing comment with our marker
# const existingComment = comments.find(comment =>
# comment.user.type === 'Bot' &&
# comment.body.includes(commentMarker)
# );

# if (existingComment) {
# // Update existing comment
# await github.rest.issues.updateComment({
# owner: context.repo.owner,
# repo: context.repo.repo,
# comment_id: existingComment.id,
# body: body,
# });
# } else {
# // Create new comment
# await github.rest.issues.createComment({
# owner: context.repo.owner,
# repo: context.repo.repo,
# issue_number: context.issue.number,
# body: body,
# });
# }

# - name: Create Issue From File
# if: steps.lychee.outputs.exit_code != 0 && github.event_name == 'schedule'
# uses: peter-evans/create-issue-from-file@v5
# with:
# title: Link Checker Report
# content-filepath: ./lychee/out.md
# labels: 'type: documentation'
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/commitizen-tools/commitizen/pythonpackage.yml?label=python%20package&logo=github&logoColor=white&style=flat-square)](https://github.com/commitizen-tools/commitizen/actions)
[![Check Links](https://github.com/commitizen-tools/commitizen/actions/workflows/links.yml/badge.svg)](https://github.com/commitizen-tools/commitizen/actions/workflows/links.yml)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat-square)](https://conventionalcommits.org)
[![PyPI Package latest release](https://img.shields.io/pypi/v/commitizen.svg?style=flat-square)](https://pypi.org/project/commitizen/)
[![PyPI Package download count (per month)](https://img.shields.io/pypi/dm/commitizen?style=flat-square)](https://pypi.org/project/commitizen/)
Expand Down