Skip to content

Commit

Permalink
Update DeadLink workflow to use latest deadfinder version and generat…
Browse files Browse the repository at this point in the history
…e a Markdown report

Signed-off-by: HAHWUL <hahwul@gmail.com>
  • Loading branch information
hahwul committed Nov 8, 2024
1 parent d1dc540 commit 65ea3f9
Showing 1 changed file with 44 additions and 29 deletions.
73 changes: 44 additions & 29 deletions .github/workflows/deadlinks.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,45 @@
---
name: DeadLink
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Find Broken Link
uses: hahwul/deadfinder@1.4.4
id: broken-link
with:
command: sitemap
target: https://owasp-noir.github.io/noir/sitemap.xml
- name: Create an issue
uses: dacbd/create-issue-action@main
with:
token: ${{ github.token }}
title: DeadLink Issue
body: |
```json
${{ steps.broken-link.outputs.output }}
```
name: DeadLink
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Find Broken Link
uses: hahwul/deadfinder@1.5.0
id: broken-link
with:
command: sitemap
target: https://owasp-noir.github.io/noir/sitemap.xml

- name: Create Markdown Table from JSON
id: create-markdown-table
run: |
echo "## DeadLink Report" > deadlink_report.md
echo "" >> deadlink_report.md
echo "| Target URL | Deadlink |" >> deadlink_report.md
echo "|------------|------------|" >> deadlink_report.md
echo '${{ steps.broken-link.outputs.output }}' | jq -r 'to_entries[] | .key as $k | .value[] | "| \($k) | \(.) |"' >> deadlink_report.md
- name: Read Markdown Table from File
id: read-markdown-table
run: |
table_content=$(cat deadlink_report.md)
echo "TABLE_CONTENT<<EOF" >> $GITHUB_ENV
echo "$table_content" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create an issue
uses: dacbd/create-issue-action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: DeadLink Issue
body: ${{ env.TABLE_CONTENT }}

0 comments on commit 65ea3f9

Please sign in to comment.