Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
15 changes: 9 additions & 6 deletions .github/workflows/markdown-fail-fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Markdown (Fail Fast)
on:
push:
paths:
- "**.md"
- "**/*.md"
pull_request:
paths:
- "**.md"
- "**/*.md"

permissions:
contents: read
Expand Down Expand Up @@ -47,21 +47,24 @@ jobs:
exit 1
fi

MD=$(echo "$CHANGED" | tr '\n' ' ' | xargs)
MD=$(echo "$CHANGED" | tr '\n' ',' | xargs)
echo "Markdown files changed: $MD"
echo "md=$MD" >> "$GITHUB_OUTPUT"

lint:
name: lint markdown files
runs-on: ubuntu-latest
needs: changedfiles
if: ${{needs.changedfiles.outputs.md}}
if: ${{needs.changedfiles.outputs.md != ','}}
steps:
- name: Checkout Repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Run linter
uses: docker://avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee
uses: DavidAnson/markdownlint-cli2-action@8de2aa07cae85fd17c0b35642db70cf5495f1d25 # v24.0.0
with:
args: ${{needs.changedfiles.outputs.md}}
config: .markdownlint-cli2.yaml
fix: false
globs: ${{needs.changedfiles.outputs.md}}
separator: ','
55 changes: 40 additions & 15 deletions .github/workflows/markdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@ on:
repository_dispatch:
workflow_dispatch:
schedule:
# Everyday at 9:00 AM.
- cron: "0 9 * * *"
# Everyday at 9:00 AM.
- cron: "0 9 * * *"
pull_request:
branches:
- main
paths:
- ".github/workflows/markdown.yml"

# Declare default permissions as read only.
permissions: read-all

jobs:
lint-markdown:
permissions:
issues: write # required for creating issues from markdown lint reports
runs-on: ubuntu-latest
outputs:
lint_outcome: ${{ steps.markdownlint.outcome }}
steps:
- name: Checkout Repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -23,16 +28,36 @@ jobs:

- name: Run linter
id: markdownlint
uses: docker://avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee
uses: DavidAnson/markdownlint-cli2-action@8de2aa07cae85fd17c0b35642db70cf5495f1d25 # v24.0.0
with:
config: .markdownlint.yaml
args: '**/*.md'
output: ./markdownlint.txt
config: .markdownlint-cli2.yaml
fix: false
globs: |
**/*.md
continue-on-error: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Once the trigger indentation is fixed, the new pull_request path will reuse a job with issues: write, continue-on-error, and unconditional issue management. On same-repository PRs, a lint failure can create the shared workflow issue while the job stays green, and a passing PR can close an issue raised by main; on fork PRs, attempted mutations are denied.

Could we give PRs a read-only path where lint failures fail the job, and keep issue management only for non-PR monitoring runs?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have split the report step into it's own job with different path.

You don't want this job to fail the ci as it is scanning the entire repo. We have the fail fast check which only fails if a changed file fails the linting.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The split keeps issue writes out of PRs, but continue-on-error remains unconditional, so a failure in this self-check still leaves the PR workflow green. The fail-fast workflow only runs for Markdown changes, so it does not cover a PR that changes this workflow.

Could we make continue-on-error conditional on github.event_name == 'schedule'?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

If i do that, the following will occur. lets say a new linter rule is introduced then the pr to update it will now fail rather than doing what it does now which is allowing it to pass and instead creating an action item to address it.

In effect it eliminate nearly any need for the reporting workflows as it would only occur if someone merged a pr with a failed linter check.


- name: Create Issue From File
if: steps.markdownlint.outputs.exit_code != 0
uses: peter-evans/create-issue-from-file@fca9117c27cdc29c6c4db3b86c48e4115a786710 # v6.0.0
with:
title: Markdown Lint Report
content-filepath: ./markdownlint.txt
labels: report, bot-generated
report:
if: github.event_name == 'schedule'
needs: lint-markdown
permissions:
issues: write # required for creating issues from markdown lint reports
runs-on: ubuntu-latest
steps:
- name: Manage issue
if: github.event_name == 'schedule'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This job starts on a fresh runner without checkout or GH_REPO, so gh issue list exits before it can manage anything. The conditions below also use steps.markdownlint.outcome, but that step is in lint-markdown; here it is empty, which would close an existing issue after a failure and never create a missing one.

Could we pass the repository explicitly and read needs.lint-markdown.outputs.lint_outcome?

run: |
number=$(gh issue list --search "in:title Workflow failed: $GITHUB_WORKFLOW" --limit 1 --json number -q .[].number)

echo $number

if [[ $number ]]; then
if [[ "${{ steps.markdownlint.outcome }}" != "failure" ]]; then
gh issue close $number
fi
elif [[ "${{ steps.markdownlint.outcome }}" == "failure" ]]; then
gh issue create --title "Workflow failed: $GITHUB_WORKFLOW (#$GITHUB_RUN_NUMBER)" \
--body "See [$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)." \
--label "report,bot-generated"
fi
1 change: 1 addition & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ https://localhost
http://jaeger-collector
https://github.com/open-telemetry/opentelemetry-go/milestone/
https://github.com/open-telemetry/opentelemetry-go/projects
https://github.com/\$GITHUB_REPOSITORY/actions/runs/\$GITHUB_RUN_ID
# Weaver model URL for semantic-conventions repository.
https?:\/\/github\.com\/open-telemetry\/semantic-conventions\/archive\/refs\/tags\/[^.]+\.zip\[[^]]+]
file:///home/runner/work/opentelemetry-go/opentelemetry-go/libraries
Expand Down
3 changes: 3 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
config:
extends: .markdownlint.yaml
gitignore: '**/.{git,markdownlint}ignore'
11 changes: 11 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ MD029:
# no-inline-html
MD033: false

# no-bare-urls
MD034: false

# fenced-code-language
MD040: false

# link-image-reference-definitions
MD053: false

# descriptive-link-text
MD059: false

# table-column-style
MD060: false
1 change: 1 addition & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.github/ISSUE_TEMPLATE
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

- The simple span and log processors record `otel.sdk.processor.{span,log}.processed` when the record is submitted to the exporter instead of after the export completes, and no longer set `error.type` from the export outcome, in `go.opentelemetry.io/otel/sdk/trace` and `go.opentelemetry.io/otel/sdk/log`. (#8705)

<!-- markdownlint-capture -->
<!-- markdownlint-disable -->

<!-- Released section -->
<!-- Don't change this section unless doing release -->

Expand Down Expand Up @@ -3900,6 +3903,8 @@ It contains api and sdk for trace and meter.

<!-- Released section ended -->

<!-- markdownlint-restore -->

[Go 1.26]: https://go.dev/doc/go1.26
[Go 1.25]: https://go.dev/doc/go1.25
[Go 1.24]: https://go.dev/doc/go1.24
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ add-tags: verify-mods
MARKDOWNIMAGE := $(shell awk '$$4=="markdown" {print $$2}' $(DEPENDENCIES_DOCKERFILE))
.PHONY: lint-markdown
lint-markdown:
docker run --rm -u $(DOCKER_USER) -v "$(CURDIR):$(WORKDIR)" $(MARKDOWNIMAGE) -c $(WORKDIR)/.markdownlint.yaml $(WORKDIR)/**/*.md
docker run --rm -u $(DOCKER_USER) -v "$(CURDIR):$(WORKDIR)" $(MARKDOWNIMAGE) --config $(WORKDIR)/.markdownlint-cli2.yaml $(WORKDIR)/**/*.md

.PHONY: verify-readmes
verify-readmes: $(VERIFYREADMES)
Expand Down
2 changes: 1 addition & 1 deletion dependencies.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This is a renovate-friendly source of Docker images.
FROM python:3.13.6-slim-bullseye@sha256:e98b521460ee75bca92175c16247bdf7275637a8faaeb2bcfa19d879ae5c4b9a AS python
FROM otel/weaver:v0.25.1@sha256:9ad46ca9cd4fa5974b121f886aa3e9946a8ef8ea905001a96c018d21f9db87ca AS weaver
FROM avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee AS markdown
FROM davidanson/markdownlint-cli2:v0.23.1@sha256:f382ea4fdc949883e79de678009437fb40c339323654c7b0dd4d5221cda8ed20 AS markdown
Loading