Skip to content
Merged
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
46 changes: 44 additions & 2 deletions .github/workflows/Breakage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,49 @@ jobs:
fi
done >> summary.md

- name: Display summary in CI logs
run: |
echo "### Breakage Summary" >> $GITHUB_STEP_SUMMARY
cat breakage/summary.md >> $GITHUB_STEP_SUMMARY

- name: PR comment with file
uses: thollander/actions-comment-pull-request@v2
if: github.event.pull_request.head.repo.fork == false
uses: actions/github-script@main
with:
filePath: breakage/summary.md
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
// Import file content from summary.md
const fs = require('fs')
const filePath = 'breakage/summary.md'
const msg = fs.readFileSync(filePath, 'utf8')

// Get the current PR number from context
const prNumber = context.payload.pull_request.number

// Fetch existing comments on the PR
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber
})

// Find a previous comment by the bot to update
const botComment = comments.find(comment => comment.user.id === 41898282)

if (botComment) {
// Update the existing comment
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: msg
})
} else {
// Create a new comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: msg
})
}
Loading