Skip to content

Commit 6483620

Browse files
authored
Merge pull request #452 from owasp-noir/enhance-deadlinks-workflow
Enhance deadlinks workflow
2 parents d1dc540 + 65ea3f9 commit 6483620

File tree

1 file changed

+44
-29
lines changed

1 file changed

+44
-29
lines changed

.github/workflows/deadlinks.yml

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,45 @@
11
---
2-
name: DeadLink
3-
# Controls when the workflow will run
4-
on:
5-
# Allows you to run this workflow manually from the Actions tab
6-
workflow_dispatch:
7-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
8-
jobs:
9-
# This workflow contains a single job called "build"
10-
build:
11-
# The type of runner that the job will run on
12-
runs-on: ubuntu-latest
13-
14-
# Steps represent a sequence of tasks that will be executed as part of the job
15-
steps:
16-
- name: Find Broken Link
17-
uses: hahwul/deadfinder@1.4.4
18-
id: broken-link
19-
with:
20-
command: sitemap
21-
target: https://owasp-noir.github.io/noir/sitemap.xml
22-
- name: Create an issue
23-
uses: dacbd/create-issue-action@main
24-
with:
25-
token: ${{ github.token }}
26-
title: DeadLink Issue
27-
body: |
28-
```json
29-
${{ steps.broken-link.outputs.output }}
30-
```
2+
name: DeadLink
3+
# Controls when the workflow will run
4+
on:
5+
# Allows you to run this workflow manually from the Actions tab
6+
workflow_dispatch:
7+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
8+
jobs:
9+
# This workflow contains a single job called "build"
10+
build:
11+
# The type of runner that the job will run on
12+
runs-on: ubuntu-latest
13+
14+
# Steps represent a sequence of tasks that will be executed as part of the job
15+
steps:
16+
- name: Find Broken Link
17+
uses: hahwul/deadfinder@1.5.0
18+
id: broken-link
19+
with:
20+
command: sitemap
21+
target: https://owasp-noir.github.io/noir/sitemap.xml
22+
23+
- name: Create Markdown Table from JSON
24+
id: create-markdown-table
25+
run: |
26+
echo "## DeadLink Report" > deadlink_report.md
27+
echo "" >> deadlink_report.md
28+
echo "| Target URL | Deadlink |" >> deadlink_report.md
29+
echo "|------------|------------|" >> deadlink_report.md
30+
echo '${{ steps.broken-link.outputs.output }}' | jq -r 'to_entries[] | .key as $k | .value[] | "| \($k) | \(.) |"' >> deadlink_report.md
31+
32+
- name: Read Markdown Table from File
33+
id: read-markdown-table
34+
run: |
35+
table_content=$(cat deadlink_report.md)
36+
echo "TABLE_CONTENT<<EOF" >> $GITHUB_ENV
37+
echo "$table_content" >> $GITHUB_ENV
38+
echo "EOF" >> $GITHUB_ENV
39+
40+
- name: Create an issue
41+
uses: dacbd/create-issue-action@main
42+
with:
43+
token: ${{ secrets.GITHUB_TOKEN }}
44+
title: DeadLink Issue
45+
body: ${{ env.TABLE_CONTENT }}

0 commit comments

Comments
 (0)