Skip to content

Commit

Permalink
chore: remove PR comment section of workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
devindford committed Oct 17, 2024
1 parent 37fa1da commit c865ac6
Showing 1 changed file with 1 addition and 55 deletions.
56 changes: 1 addition & 55 deletions .github/workflows/codeowner_review_status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,58 +163,4 @@ jobs:
core.setFailed(`Missing approvals from code owners: ${missingApprovals.map(status => status.owner).join(', ')}`);
} else {
console.log('All relevant code owners have approved the pull request.');
}
core.setOutput('codeOwnerStatus', JSON.stringify(codeOwnerStatus));
- name: Update PR status
if: always()
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const { owner, repo, number } = context.issue;
const codeOwnerStatus = JSON.parse(process.env.CODE_OWNER_STATUS);
const statusList = codeOwnerStatus.map(status => {
const emoji = status.approved ? '✅' : '❌';
return `${emoji} ${status.owner}`;
}).join('\n');
const commentBody = `## Code Owners Approval Status
${statusList}
${codeOwnerStatus.every(status => status.approved)
? '✅ All required code owners have approved this pull request.'
: '❌ This pull request is still missing approvals from one or more code owners.'}`;
// Find existing bot comment
const { data: comments } = await github.rest.issues.listComments({
owner,
repo,
issue_number: number,
});
const botComment = comments.find(comment =>
comment.user.type === 'Bot' && comment.body.includes('Code Owners Approval Status')
);
if (botComment) {
// Update existing comment
await github.rest.issues.updateComment({
owner,
repo,
comment_id: botComment.id,
body: commentBody,
});
} else {
// Create new comment
await github.rest.issues.createComment({
owner,
repo,
issue_number: number,
body: commentBody,
});
}
env:
CODE_OWNER_STATUS: ${{ steps.check_approvals.outputs.codeOwnerStatus }}
}

0 comments on commit c865ac6

Please sign in to comment.