-
Notifications
You must be signed in to change notification settings - Fork 182
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
check-links added to repo #1559
Changes from 6 commits
12dcac8
f08e20e
8fa8977
9d8ad7c
142ab91
d91bdb8
751d0a2
de1ac10
c684b3b
4daf044
51ca6ed
0cb7103
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: check-links | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref }} | ||
jobs: | ||
changedfiles: | ||
name: changed files | ||
runs-on: ubuntu-latest | ||
env: | ||
PR_HEAD: ${{ github.event.pull_request.head.sha }} | ||
outputs: | ||
md: ${{ steps.changes.outputs.md }} | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | ||
with: | ||
fetch-depth: 0 | ||
- name: Get changed files | ||
id: changes | ||
run: | | ||
echo "md=$(git diff --name-only --diff-filter=ACMRTUXB $(git merge-base origin/main $PR_HEAD) $PR_HEAD | grep .md$ | xargs)" >> $GITHUB_OUTPUT | ||
|
||
check-links: | ||
runs-on: ubuntu-latest | ||
needs: changedfiles | ||
if: ${{needs.changedfiles.outputs.md}} | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install markdown-link-check | ||
run: npm install | ||
|
||
- name: Run markdown-link-check | ||
run: | | ||
npx --no -- markdown-link-check \ | ||
--verbose \ | ||
--config .github/workflows/check_links_config.json \ | ||
${{needs.changedfiles.outputs.md}} \ | ||
|| { echo "Check that anchor links are lowercase"; exit 1; } | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"ignorePatterns": [ | ||
{ | ||
"pattern": "http(s)?://\\d+\\.\\d+\\.\\d+\\.\\d+" | ||
}, | ||
{ | ||
"pattern": "http(s)?://localhost" | ||
}, | ||
{ | ||
"pattern": "http(s)?://example.com" | ||
}, | ||
{ | ||
"pattern": "https://docs.aws.amazon.com" | ||
}, | ||
{ | ||
"pattern": "https://console.aws.amazon.com" | ||
} | ||
], | ||
"aliveStatusCodes": [429, 200], | ||
"httpHeaders": [ | ||
{ | ||
"urls": ["https://docs.aws.amazon.com", "https://docs.github.com/"], | ||
"headers": { | ||
"Accept-Encoding": "zstd, br, gzip, deflate" | ||
} | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// <autogenerated /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the changes to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. I'll do that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done @tylerbenson any further changes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant the whole There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I did notice that those files somewhat gets automatically added after cloning the repo and running a build, hence why they are being commited as changes, not sure why though. I want to try to reclone and commit the github workflow changes again however to see if it fixes that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, you should be seeing only the changes in the |
||
using System; | ||
using System.Reflection; | ||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by a tool. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
using System; | ||
using System.Reflection; | ||
|
||
[assembly: System.Reflection.AssemblyCompanyAttribute("AwsSdkSample")] | ||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] | ||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] | ||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+12dcac8a3c062ae9f08b68ccb0a9fd218dadceff")] | ||
[assembly: System.Reflection.AssemblyProductAttribute("AwsSdkSample")] | ||
[assembly: System.Reflection.AssemblyTitleAttribute("AwsSdkSample")] | ||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] | ||
|
||
// Generated by the MSBuild WriteCodeFragment class. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
f51ad78188229488c5ce47b8a0e66d0eabafb9b692073a68b5b3ce4131b0e71c |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
is_global = true | ||
build_property.TargetFramework = net6.0 | ||
build_property.TargetPlatformMinVersion = | ||
build_property.UsingMicrosoftNETSdkWeb = | ||
build_property.ProjectTypeGuids = | ||
build_property.InvariantGlobalization = | ||
build_property.PlatformNeutralAssembly = | ||
build_property.EnforceExtendedAnalyzerRules = | ||
build_property._SupportedPlatformList = Linux,macOS,Windows | ||
build_property.RootNamespace = AwsSdkSample | ||
build_property.ProjectDir = C:\Users\hp\Desktop\Outreachy Contribution Phase\OpenTelemetry\OL\opentelemetry-lambda\dotnet\sample-apps\aws-sdk\wrapper\SampleApps\AwsSdkSample\ | ||
build_property.EnableComHosting = | ||
build_property.EnableGeneratedComInterfaceComImportInterop = | ||
build_property.EffectiveAnalysisLevelStyle = 6.0 | ||
build_property.EnableCodeStyleSeverity = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain this line a bit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, This line of code runs the markdown-link-check with verbose logging enabled and specifies the custom configuration file (check_links_config.json). The
needs.changedfiles.outputs.md
variable is used to dynamically target only the markdown files that were modified in the PR.The ||
{ echo "Check that anchor links are lowercase"; exit 1; }
part is a fallback check to ensure that if there are any issues with the anchor links not being lowercase (which is a requirement for valid markdown links), the workflow will fail and print a meaningful message for the contributor to resolve.However, if this check is redundant, I can adjust or remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not objecting to the current implementation, but I wonder if maybe a linter would do a better job of that particular edge case. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that a linter might be more appropriate for this edge case, as it would likely cover more general cases of markdown formatting and anchor validation. Not quite sure how to implement exactly for this as I'm new here. I'll appreciate any help @tylerbenson
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any specific insight here. Maybe investigate what other OpenTelemetry repos are doing?