Skip to content

Commit

Permalink
Update check-for-integration-result.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthkp authored Nov 5, 2024
1 parent 828aa61 commit 7fbf57a
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions .github/workflows/check-for-integration-result.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,27 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const result = await github.rest.issues.listComments({
const issue = {
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});
const integrationComments = result.data.filter(c => c.user.login == 'primer-integration[bot]') // && c.body.includes('test-result'))
}
const result = await github.rest.issues.listComments(issue);
const integrationComments = result.data.filter(c => c.user.login == 'primer-integration[bot]' && c.body.includes('<!-- test-result'))
console.log(integrationComments)
if (integrationComments.length === 0) return
const latestComment = integrationComments.sort(c => c.createdAt)[0]
if (latestComment) {
// add label
}
const latestComment = integrationComments.pop()
const pass = latestComment.includes(':green-circle:')
await github.rest.issues.addLabels({
...issue,
labels: [pass ? 'integration-tests: passing' : 'integration-tests: failing'],
})
await github.rest.issues.removeLabel({
...issue,
name: ['integration-tests: recommended'],
})

0 comments on commit 7fbf57a

Please sign in to comment.