-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workflows: rstcheck: add a check to catch new issues
Use the delta function with rstcheck to check for any new errors being introduced by a PR. Signed-off-by: Randolph Sapp <[email protected]>
- Loading branch information
1 parent
4d90bc6
commit 6f8694e
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
name: "rstcheck" | ||
|
||
on: | ||
pull_request: | ||
branches: [master] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
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 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Update refs and settings | ||
run: | | ||
git config --global --add safe.directory "$PWD" | ||
git switch -C pr | ||
git fetch --no-tags --depth=1 origin master | ||
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" | ||
- 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 }} | ||
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 | ||
}) |