Skip to content

Commit f86af91

Browse files
committed
use Bob to spellcheck and comment with suggestions
1 parent 43e9c17 commit f86af91

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

.github/workflows/spellchecker.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: 'Spellchecking'
2+
3+
on:
4+
pull_request:
5+
paths: ['releasenotes/notes/*.yaml']
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
jobs:
12+
spellcheckreleasenotes:
13+
# if: github.repository_owner == 'Qiskit'
14+
name: Spell check release notes
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v5
18+
- name: Get release notes
19+
id: release-note-yamls
20+
uses: tj-actions/changed-files@v47
21+
with:
22+
files: |
23+
releasenotes/notes/*.yaml
24+
- uses: actions/setup-node@v6
25+
if: steps.release-note-yamls.outputs.any_changed == 'true'
26+
with:
27+
node-version: 24
28+
- name: Install Bob
29+
if: steps.release-note-yamls.outputs.any_changed == 'true'
30+
run: |
31+
curl -fsSL https://bob.ibm.com/download/bobshell.sh | bash -s -- --pm npm
32+
- name: Spell checking
33+
if: steps.release-note-yamls.outputs.any_changed == 'true'
34+
id: spellcheck
35+
env:
36+
BOBSHELL_API_KEY: ${{ secrets.BOBSHELL_API_KEY }}
37+
RELEASE_NOTE_FILES: ${{ steps.release-note-yamls.outputs.all_changed_files }}
38+
GH_TOKEN: ${{ github.token }}
39+
run: |
40+
BOB_PROMPT="Correct spelling and grammar of $(echo $RELEASE_NOTE_FILES | sed 's/releasenotes/@releasenotes/' ) . If possible, avoid redundancies and repetitions."
41+
echo $BOB_PROMPT
42+
bob "$BOB_PROMPT" --hide-intermediary-output --yolo > BOB_RESPONSE.txt
43+
echo 'BOB_RESPONSE<<EOF' >> $GITHUB_OUTPUT
44+
echo "Bob has some suggestions to improve the release notes:" >> $GITHUB_OUTPUT
45+
echo "\`\`\`" >> $GITHUB_OUTPUT
46+
cat BOB_RESPONSE.txt >> $GITHUB_OUTPUT
47+
echo "\`\`\`" >> $GITHUB_OUTPUT
48+
echo 'EOF' >> $GITHUB_OUTPUT
49+
- uses: tj-actions/verify-changed-files@v20
50+
name: "Check if Bob made any fixes"
51+
id: verify-changed-files
52+
- uses: parkerbxyz/suggest-changes@v3
53+
name: "Comment with Bob suggestions"
54+
if: steps.verify-changed-files.outputs.files_changed == 'true'
55+
with:
56+
comment: ${{ steps.spellcheck.outputs.BOB_RESPONSE }}
57+
event: 'COMMENT'

0 commit comments

Comments
 (0)