Skip to content

Commit

Permalink
[chore] run markdown-link-check on version change (#36645)
Browse files Browse the repository at this point in the history
#### Description
This PR will run the "markdown-link-check" tool if the version of the
tool changes even if no markdown files were updated. This will help to
confirm that "markdown-link-check" is still working as expected after a
version update/pin.

~~If 1+ *.md files gets changed AND the version gets updated, it will
only check the updated files to keep the same behaviour as before.~~

~~If only the version gets updated it will test all existing *.md
files.~~

**EDIT:** 

After feedback and suggestion from @mowies (thank you again! :) ), I
switched to use a
[predefined](https://github.com/tj-actions/changed-files) github action
which checks markdown files changes AND if the
`.github/workflows/check-links.yaml` changed.

If the '.github/workflows/check-links.yaml' file, the
markdown-link-check tool will test against all markdown files existing
in the repo. This would catch a version change of the
"markdown-link-check" tool and test it accordingly.

If 1+ *.md file gets changed while the
`.github/workflows/check-links.yaml` file does **not** change, it will
only test the changed files to keep the same behaviour like before.

/cc @mx-psi @mowies @ChrsMark 

#### Link to tracking issue
Fixes
#36588

---------

Co-authored-by: Christos Markou <[email protected]>
  • Loading branch information
niwoerner and ChrsMark authored Dec 11, 2024
1 parent 421d710 commit 11fe136
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 17 deletions.
29 changes: 19 additions & 10 deletions .github/workflows/check-links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,44 @@ jobs:
changedfiles:
name: changed files
runs-on: ubuntu-24.04
env:
PR_HEAD: ${{ github.event.pull_request.head.sha }}
if: ${{ github.actor != 'dependabot[bot]' }}
outputs:
md: ${{ steps.changes.outputs.md }}
md_files: ${{ steps.changed-files.outputs.md_all_changed_files }}
yaml_files: ${{ steps.changed-files.outputs.yaml_all_changed_files }} # used to catch MD_LINK_CHECK_VERSION updates and runs check-links to confirm functionality
steps:
- uses: actions/checkout@v4
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
id: changed-files
uses: tj-actions/changed-files@v45
with:
files_yaml: |
md:
- '**.md'
yaml:
- .github/workflows/check-links.yaml
check-links:
runs-on: ubuntu-24.04
needs: changedfiles
if: ${{needs.changedfiles.outputs.md}}
if: needs.changedfiles.outputs.md_files || needs.changedfiles.outputs.yaml_files
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install markdown-link-check
run: npm install -g markdown-link-check@${{ env.MD_LINK_CHECK_VERSION }}

- name: Run markdown-link-check
run: |
if [ -n "${{ needs.changedfiles.outputs.yaml_files }}" ]; then
md=$(find . -type f -name "*.md")
else
md="${{ needs.changedfiles.outputs.md_files }}"
fi
markdown-link-check \
--verbose \
--config .github/workflows/check_links_config.json \
${{needs.changedfiles.outputs.md}} \
$md \
|| { echo "Check that anchor links are lowercase"; exit 1; }
3 changes: 3 additions & 0 deletions .github/workflows/check_links_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
},
{
"pattern": "^#"
},
{
"pattern": "https://blogs\\.oracle\\.com/developers/post/connecting-a-go-application-to-oracle-database"
}
],
"aliveStatusCodes": [429, 200]
Expand Down
2 changes: 1 addition & 1 deletion cmd/telemetrygen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ You can build locally the Docker image with:
make docker-telemetrygen
```

Using github actions, we also push a docker image on commit to main or on release to this [Github docker registry](https://github.com/open-telemetry/opentelemetry-collector-contrib/pkgs/container/opentelemetry-collector-contrib%2Ftelemetrygen).
Using github actions, we also push a docker image on commit to main or on release to this [Github docker registry](https://github.com/orgs/open-telemetry/packages/container/package/opentelemetry-collector-contrib%2Ftelemetrygen).

## Running

Expand Down
2 changes: 1 addition & 1 deletion exporter/azuremonitorexporter/conventions.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const (

// NetworkAttributes is the set of known network attributes
type NetworkAttributes struct {
// see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/span-general.md#general-network-connection-attributes
// see https://github.com/open-telemetry/semantic-conventions/blob/main/docs/attributes-registry/network.md#network-attributes
NetTransport string
NetPeerIP string
NetPeerPort int64
Expand Down
2 changes: 1 addition & 1 deletion pkg/stanza/docs/operators/tcp_input.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The `tcp_input` operator listens for logs on one or more TCP connections. The op
| `attributes` | {} | A map of `key: value` pairs to add to the entry's attributes. |
| `one_log_per_packet` | false | Skip log tokenization, set to true if logs contains one log per record and multiline is not used. This will improve performance. |
| `resource` | {} | A map of `key: value` pairs to add to the entry's resource. |
| `add_attributes` | false | Adds `net.*` attributes according to [semantic convention][https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/span-general.md#general-network-connection-attributes]. |
| `add_attributes` | false | Adds `net.*` attributes according to [semantic convention][https://github.com/open-telemetry/semantic-conventions/blob/main/docs/attributes-registry/network.md#network-attributes]. |
| `multiline` | | A `multiline` configuration block. See below for details. |
| `preserve_leading_whitespaces` | false | Whether to preserve leading whitespaces. |
| `preserve_trailing_whitespaces` | false | Whether to preserve trailing whitespaces. |
Expand Down
2 changes: 1 addition & 1 deletion pkg/translator/prometheus/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prometheus Normalization

[OpenTelemetry's metric semantic convention](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/README.md) is not compatible with [Prometheus' own metrics naming convention](https://prometheus.io/docs/practices/naming/). This module provides centralized functions to convert OpenTelemetry metrics to Prometheus-compliant metrics. These functions are used by the following components for Prometheus:
[OpenTelemetry's metric semantic convention](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/metrics.md) is not compatible with [Prometheus' own metrics naming convention](https://prometheus.io/docs/practices/naming/). This module provides centralized functions to convert OpenTelemetry metrics to Prometheus-compliant metrics. These functions are used by the following components for Prometheus:

* [prometheusreceiver](../../../receiver/prometheusreceiver/)
* [prometheusexporter](../../../exporter/prometheusexporter/)
Expand Down
2 changes: 1 addition & 1 deletion pkg/translator/prometheus/normalize_name.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

// The map to translate OTLP units to Prometheus units
// OTLP metrics use the c/s notation as specified at https://ucum.org/ucum.html
// (See also https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/README.md#instrument-units)
// (See also https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/metrics.md#instrument-units)
// Prometheus best practices for units: https://prometheus.io/docs/practices/naming/#base-units
// OpenMetrics specification for units: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#units-and-base-units
var unitMap = map[string]string{
Expand Down
2 changes: 1 addition & 1 deletion receiver/azureblobreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<!-- end autogenerated section -->


This receiver reads logs and trace data from [Azure Blob Storage](https://azure.microsoft.com/services/storage/blobs/).
This receiver reads logs and trace data from [Azure Blob Storage](https://azure.microsoft.com/en-us/products/storage/blobs/).

## Configuration

Expand Down
2 changes: 1 addition & 1 deletion receiver/tcplogreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Receives logs over TCP.
| `attributes` | {} | A map of `key: value` pairs to add to the entry's attributes |
| `one_log_per_packet` | false | Skip log tokenization, set to true if logs contains one log per record and multiline is not used. This will improve performance. |
| `resource` | {} | A map of `key: value` pairs to add to the entry's resource |
| `add_attributes` | false | Adds `net.*` attributes according to [semantic convention][https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/span-general.md#general-network-connection-attributes] |
| `add_attributes` | false | Adds `net.*` attributes according to [semantic convention][https://github.com/open-telemetry/semantic-conventions/blob/main/docs/attributes-registry/network.md#network-attributes] |
| `multiline` | | A `multiline` configuration block. See below for details |
| `encoding` | `utf-8` | The encoding of the file being read. See the list of supported encodings below for available options |
| `operators` | [] | An array of [operators](../../pkg/stanza/docs/operators/README.md#what-operators-are-available). See below for more details |
Expand Down

0 comments on commit 11fe136

Please sign in to comment.