Skip to content

Commit 92fd61d

Browse files
authored
Merge pull request #26 from StaticRocket/master
Bugfix/try-ci-again
2 parents dfd6fa7 + 3c2e75b commit 92fd61d

File tree

3 files changed

+74
-36
lines changed

3 files changed

+74
-36
lines changed

.github/workflows/comment.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: "comment"
3+
4+
on:
5+
workflow_run:
6+
workflows:
7+
- rstcheck
8+
types:
9+
- completed
10+
11+
jobs:
12+
comment:
13+
name: Comment
14+
runs-on: ubuntu-latest
15+
if: ${{ github.event.workflow_run.event == 'pull_request' }}
16+
17+
steps:
18+
- name: Download artifact
19+
uses: actions/download-artifact@v4
20+
with:
21+
name: results
22+
run-id: ${{ github.event.workflow_run.id }}
23+
github-token: ${{ secrets.GITHUB_TOKEN }}
24+
path: results
25+
26+
- name: Update pr with info from other runners
27+
uses: actions/github-script@v7
28+
with:
29+
github-token: ${{ secrets.GITHUB_TOKEN }}
30+
script: |
31+
var fs = require('fs');
32+
var issue_number = Number(fs.readFileSync('./results/id'));
33+
var problem_count = Number(fs.readFileSync(
34+
'./results/problem-count'
35+
));
36+
var summary = String(fs.readFileSync('./results/summary'));
37+
38+
if (problem_count > 0) {
39+
github.rest.issues.createComment({
40+
owner: context.repo.owner,
41+
issue_number: issue_number,
42+
repo: context.repo.repo,
43+
body: summary
44+
});
45+
}

.github/workflows/commit-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ jobs:
2929
author-email: true
3030
commit-signoff: true
3131
job-summary: true
32-
pr-comments: true
32+
pr-comments: false

.github/workflows/rstcheck.yml

Lines changed: 28 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ jobs:
1818
container:
1919
image: ghcr.io/texasinstruments/processor-sdk-doc:latest
2020
options: --entrypoint /bin/bash
21-
permissions:
22-
contents: read
23-
issues: write
24-
pull-requests: write
2521

2622
steps:
2723
- name: Checkout repository
@@ -35,37 +31,34 @@ jobs:
3531
git switch master
3632
3733
- name: Run rstcheck
38-
id: rstcheck
3934
run: |
40-
bin/delta.sh -a master -b pr \
41-
-- rstcheck -r source/
42-
if [ "$(wc -l < _new-warn.log)" -gt "0" ]; then
43-
{
44-
echo "New warnings found with rstcheck:";
45-
echo '```text';
46-
cat _new-warn.log;
47-
echo '```';
48-
} >> "$GITHUB_STEP_SUMMARY"
49-
{
50-
echo 'NEW_WARNINGS<<EOF'
51-
echo "$(< "$GITHUB_STEP_SUMMARY")"
52-
echo 'EOF'
53-
} >> "$GITHUB_OUTPUT"
54-
exit 1
55-
fi
56-
echo "No new warnings found with rstcheck" >> "$GITHUB_STEP_SUMMARY"
35+
# Run the test
36+
bin/delta.sh -a master -b pr -- rstcheck -r source/
5737
58-
- name: Update pr with info
59-
uses: actions/github-script@v7
60-
if: ${{ failure() && steps.rstcheck.outputs.NEW_WARNINGS != '' }}
61-
env:
62-
NEW_WARNINGS: ${{ steps.rstcheck.outputs.NEW_WARNINGS }}
38+
# Prepare summary
39+
WARNING_COUNT=$(wc -l < _new-warn.log)
40+
if [ "$WARNING_COUNT" -gt "0" ]; then
41+
echo "New warnings found with rstcheck:"
42+
echo '```text'
43+
cat _new-warn.log
44+
echo '```'
45+
else
46+
echo "No new warnings found with rstcheck"
47+
fi >> "$GITHUB_STEP_SUMMARY"
48+
49+
# Prepare the artifacts
50+
mkdir -p ./results
51+
echo "${{ github.event.number }}" > ./results/id
52+
cp "$GITHUB_STEP_SUMMARY" ./results/summary
53+
echo "$(wc -l < _new-warn.log)" > ./results/problem-count
54+
55+
# Exit with error if there are new warnings
56+
[ "$WARNING_COUNT" -gt "0" ] && exit 1
57+
58+
- name: Save results
59+
uses: actions/upload-artifact@v4
60+
if: always()
6361
with:
64-
github-token: ${{ secrets.GITHUB_TOKEN }}
65-
script: |
66-
github.rest.issues.createComment({
67-
owner: context.repo.owner,
68-
issue_number: context.issue.number,
69-
repo: context.repo.repo,
70-
body: process.env.NEW_WARNINGS
71-
})
62+
name: results
63+
path: results/
64+
retention-days: 1

0 commit comments

Comments
 (0)