Skip to content

Commit 9be5a40

Browse files
Manvi2402emdneto
andauthored
Fix/check links workflow condition (#4978)
* ci: fix conditional expression in check-links workflow * ci: improve check-links workflow * update CHANGELOG for #4978 * ci: address review comments * Update CHANGELOG.md --------- Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
1 parent 7849042 commit 9be5a40

File tree

2 files changed

+27
-23
lines changed

2 files changed

+27
-23
lines changed

.github/workflows/check-links.yml

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,48 @@ name: check-links
22
on:
33
push:
44
branches: [ main ]
5+
paths:
6+
- '**/*.md'
7+
- '.github/workflows/check-links.yml'
8+
- '.github/workflows/check_links_config.json'
59
pull_request:
10+
paths:
11+
- '**/*.md'
12+
- '.github/workflows/check-links.yml'
13+
- '.github/workflows/check_links_config.json'
614

715
permissions:
816
contents: read
917

18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
20+
cancel-in-progress: true
21+
1022
jobs:
11-
changedfiles:
12-
name: changed files
13-
runs-on: ubuntu-latest
14-
if: ${{ github.actor != 'dependabot[bot]' }}
15-
outputs:
16-
md: ${{ steps.changes.outputs.md }}
17-
steps:
18-
- name: Checkout Repo
19-
uses: actions/checkout@v4
20-
with:
21-
fetch-depth: 0
22-
- name: Get changed files
23-
id: changes
24-
run: |
25-
echo "md=$(git diff --name-only --diff-filter=ACMRTUXB $(git merge-base origin/main ${{ github.event.pull_request.head.sha }}) ${{ github.event.pull_request.head.sha }} | grep .md$ | xargs)" >> $GITHUB_OUTPUT
2623
check-links:
2724
runs-on: ubuntu-latest
28-
needs: changedfiles
29-
if: |
30-
github.event.pull_request.user.login != 'otelbot[bot]' && github.event_name == 'pull_request'
31-
&& ${{needs.changedfiles.outputs.md}}
25+
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'otelbot[bot]' }}
26+
timeout-minutes: 15
3227
steps:
3328
- name: Checkout Repo
34-
uses: actions/checkout@v4
29+
uses: actions/checkout@v6
30+
31+
- name: Get changed markdown files
32+
id: changed-files
33+
uses: tj-actions/changed-files@v46
3534
with:
36-
fetch-depth: 0
35+
files: |
36+
**/*.md
3737
3838
- name: Install markdown-link-check
39+
if: steps.changed-files.outputs.any_changed == 'true'
3940
run: npm install -g markdown-link-check@v3.12.2
4041

4142
- name: Run markdown-link-check
43+
if: steps.changed-files.outputs.any_changed == 'true'
4244
run: |
4345
markdown-link-check \
4446
--verbose \
4547
--config .github/workflows/check_links_config.json \
46-
${{needs.changedfiles.outputs.md}} \
47-
|| { echo "Check that anchor links are lowercase"; exit 1; }
48+
${{ steps.changed-files.outputs.all_changed_files }} \
49+
|| { echo "Check that anchor links are lowercase"; exit 1; }

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
([#4935](https://github.com/open-telemetry/opentelemetry-python/pull/4935))
2323
- `opentelemetry-sdk`: upgrade vendored OTel configuration schema from v1.0.0-rc.3 to v1.0.0
2424
([#4965](https://github.com/open-telemetry/opentelemetry-python/pull/4965))
25+
- improve check-links ci job
26+
([#4978](https://github.com/open-telemetry/opentelemetry-python/pull/4978))
2527
- Resolve some Pyright type errors in Span/ReadableSpan and utility stubs
2628
([#4973](https://github.com/open-telemetry/opentelemetry-python/pull/4973))
2729
- `opentelemetry-exporter-prometheus`: Fix metric name prefix

0 commit comments

Comments
 (0)