-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #452 from owasp-noir/enhance-deadlinks-workflow
Enhance deadlinks workflow
- Loading branch information
Showing
1 changed file
with
44 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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
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 }} |