Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add markdown check action #4907

Merged
merged 23 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from 13 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
35 changes: 35 additions & 0 deletions .github/workflows/markdown-links-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright (c) 2020-2022, NVIDIA CORPORATION.
Copy link
Collaborator

Choose a reason for hiding this comment

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

# Copyright (c) 2022, NVIDIA CORPORATION.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks, updated

#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# A workflow to check if PR got broken hyperlinks
name: Check Markdown links
jlowe marked this conversation as resolved.
Show resolved Hide resolved

on:
pull_request_target:
Copy link
Collaborator

Choose a reason for hiding this comment

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

pull_request_target -> pull_request to checkout the "refs/pull/:prNumber/merge"
otherwise the
- uses: actions/checkout@master
will check out the BASE ref here (branch-22.04)

FYI we use pull_request_target in signoff-check is only because that the check is based on BASE branch instead of relying on developer's feature branch

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks and good to know that, one question is that do we need a GITHUB_TOKEN when we use pull_request ?
If we don't add a GITHUB_TOKEN, will we hit Error: Parameter token or opts.auth is required?

Copy link
Collaborator

@pxLi pxLi Mar 16, 2022

Choose a reason for hiding this comment

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

GITHUB_TOKEN is the default token of repo and is maintained by github action itself as ENV.

If we don't add a GITHUB_TOKEN, will we hit Error: Parameter token or opts.auth is required?

For actions/checkout, no.
I am not sure where you did get this error, if the some specific action require adding specific arg, then you can try add

      with:
        token: ${{ secrets.GITHUB_TOKEN }}

above was just an example, this really arg naming depends on the action provider, if they require extra tokens (or access), they should have documented somewhere in their repo

Copy link
Collaborator

Choose a reason for hiding this comment

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

image
after changing to pull_request, you can see result in this PR's check status

types: [opened, synchronize, reopened]

jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
max-depth: -1
use-verbose-mode: 'yes'
jlowe marked this conversation as resolved.
Show resolved Hide resolved
check-modified-files-only: 'yes'
config-file: '.github/workflows/markdown-links-check/markdown-links-check-config.json'
base-branch: 'gh-pages'


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"timeout": "5s",
"retryCount":10,
"aliveStatusCodes": [0, 200, 302, 400, 403, 429]
jlowe marked this conversation as resolved.
Show resolved Hide resolved
}