Skip to content
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

Bugfix/try-ci-again #26

Merged
merged 2 commits into from
Oct 30, 2024
Merged
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
45 changes: 45 additions & 0 deletions .github/workflows/comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: "comment"

on:
workflow_run:
workflows:
- rstcheck
types:
- completed

jobs:
comment:
name: Comment
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.event == 'pull_request' }}

steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: results
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
path: results

- name: Update pr with info from other runners
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var fs = require('fs');
var issue_number = Number(fs.readFileSync('./results/id'));
var problem_count = Number(fs.readFileSync(
'./results/problem-count'
));
var summary = String(fs.readFileSync('./results/summary'));

if (problem_count > 0) {
github.rest.issues.createComment({
owner: context.repo.owner,
issue_number: issue_number,
repo: context.repo.repo,
body: summary
});
}
2 changes: 1 addition & 1 deletion .github/workflows/commit-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
author-email: true
commit-signoff: true
job-summary: true
pr-comments: true
pr-comments: false
63 changes: 28 additions & 35 deletions .github/workflows/rstcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ jobs:
container:
image: ghcr.io/texasinstruments/processor-sdk-doc:latest
options: --entrypoint /bin/bash
permissions:
contents: read
issues: write
pull-requests: write

steps:
- name: Checkout repository
Expand All @@ -35,37 +31,34 @@ jobs:
git switch master

- name: Run rstcheck
id: rstcheck
run: |
bin/delta.sh -a master -b pr \
-- rstcheck -r source/
if [ "$(wc -l < _new-warn.log)" -gt "0" ]; then
{
echo "New warnings found with rstcheck:";
echo '```text';
cat _new-warn.log;
echo '```';
} >> "$GITHUB_STEP_SUMMARY"
{
echo 'NEW_WARNINGS<<EOF'
echo "$(< "$GITHUB_STEP_SUMMARY")"
echo 'EOF'
} >> "$GITHUB_OUTPUT"
exit 1
fi
echo "No new warnings found with rstcheck" >> "$GITHUB_STEP_SUMMARY"
# Run the test
bin/delta.sh -a master -b pr -- rstcheck -r source/

- name: Update pr with info
uses: actions/github-script@v7
if: ${{ failure() && steps.rstcheck.outputs.NEW_WARNINGS != '' }}
env:
NEW_WARNINGS: ${{ steps.rstcheck.outputs.NEW_WARNINGS }}
# Prepare summary
WARNING_COUNT=$(wc -l < _new-warn.log)
if [ "$WARNING_COUNT" -gt "0" ]; then
echo "New warnings found with rstcheck:"
echo '```text'
cat _new-warn.log
echo '```'
else
echo "No new warnings found with rstcheck"
fi >> "$GITHUB_STEP_SUMMARY"

# Prepare the artifacts
mkdir -p ./results
echo "${{ github.event.number }}" > ./results/id
cp "$GITHUB_STEP_SUMMARY" ./results/summary
echo "$(wc -l < _new-warn.log)" > ./results/problem-count

# Exit with error if there are new warnings
[ "$WARNING_COUNT" -gt "0" ] && exit 1

- name: Save results
uses: actions/upload-artifact@v4
if: always()
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
owner: context.repo.owner,
issue_number: context.issue.number,
repo: context.repo.repo,
body: process.env.NEW_WARNINGS
})
name: results
path: results/
retention-days: 1