Skip to content

Commit 8de69f4

Browse files
committed
Restore and update Breakage workflow configuration
Restored and updated the Breakage workflow configuration for pull requests, including matrix setup and breakage testing steps.
1 parent cc6caab commit 8de69f4

1 file changed

Lines changed: 44 additions & 2 deletions

File tree

.github/workflows/Breakage.yml

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,49 @@ jobs:
159159
fi
160160
done >> summary.md
161161
162+
- name: Display summary in CI logs
163+
run: |
164+
echo "### Breakage Summary" >> $GITHUB_STEP_SUMMARY
165+
cat breakage/summary.md >> $GITHUB_STEP_SUMMARY
166+
162167
- name: PR comment with file
163-
uses: thollander/actions-comment-pull-request@v2
168+
if: github.event.pull_request.head.repo.fork == false
169+
uses: actions/github-script@main
164170
with:
165-
filePath: breakage/summary.md
171+
github-token: ${{ secrets.GITHUB_TOKEN }}
172+
script: |
173+
// Import file content from summary.md
174+
const fs = require('fs')
175+
const filePath = 'breakage/summary.md'
176+
const msg = fs.readFileSync(filePath, 'utf8')
177+
178+
// Get the current PR number from context
179+
const prNumber = context.payload.pull_request.number
180+
181+
// Fetch existing comments on the PR
182+
const { data: comments } = await github.rest.issues.listComments({
183+
owner: context.repo.owner,
184+
repo: context.repo.repo,
185+
issue_number: prNumber
186+
})
187+
188+
// Find a previous comment by the bot to update
189+
const botComment = comments.find(comment => comment.user.id === 41898282)
190+
191+
if (botComment) {
192+
// Update the existing comment
193+
await github.rest.issues.updateComment({
194+
owner: context.repo.owner,
195+
repo: context.repo.repo,
196+
comment_id: botComment.id,
197+
body: msg
198+
})
199+
} else {
200+
// Create a new comment
201+
await github.rest.issues.createComment({
202+
owner: context.repo.owner,
203+
repo: context.repo.repo,
204+
issue_number: prNumber,
205+
body: msg
206+
})
207+
}

0 commit comments

Comments
 (0)