Skip to content

Commit

Permalink
Fix github action
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderDokuchaev committed Mar 23, 2024
1 parent 1497dc2 commit c548848
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.7

- Fixed github action to set not default config file.
- Updated readme of usage github actions.

## 0.6

- Github Action checks web link in changed files only for pull request events.
Expand Down
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: AlexanderDokuchaev/md-dead-link-check@v0.6
- uses: AlexanderDokuchaev/md-dead-link-check@v0.7
```
### Option 2: Pre-Commit
Expand All @@ -57,6 +57,44 @@ Adding to your `.pre-commit-config.yaml` to integrate in [pre-commit](https://pr
- id: md-dead-link-check
```

> [!NOTE]
> For the `pull_request` event type, the action will only check external links for files that have been modified.
> To scan all links, consider using a separate action that runs periodically on target branches.
> This approach helps prevent pull request merges from being blocked by broken links unrelated to the files
> modified in the pull request.

```yaml
# .github/workflows/nightly.yaml
name: nightly
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
md-dead-link-check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: AlexanderDokuchaev/[email protected]
```

```yaml
# .github/workflows/pull_request.yaml
name: pull_request
on:
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
md-dead-link-check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: AlexanderDokuchaev/[email protected]
```

### Option 3: Install from pip

For direct use, install with pip and run:
Expand Down
4 changes: 2 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ runs:
if: github.event_name == 'pull_request'
env:
CHANGED_FILES: ${{ steps.changed-markdown-files.outputs.all_changed_files }}
run: md-dead-link-check --hook ${CHANGED_FILES}
run: md-dead-link-check --config=${{ inputs.config }} --hook ${CHANGED_FILES}
shell: bash

- name: Check all links
if: github.event_name != 'pull_request'
run: md-dead-link-check
run: md-dead-link-check --config=${{ inputs.config }}
shell: bash

0 comments on commit c548848

Please sign in to comment.