Skip to content

Commit

Permalink
fix: wf
Browse files Browse the repository at this point in the history
  • Loading branch information
FredrikOseberg committed Dec 9, 2024
1 parent 5513a91 commit 72e535d
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions .github/workflows/core-feature-alert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
script: |
const prNumber = context.payload.pull_request.number;
// Check if a comment already exists
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -49,31 +50,35 @@ jobs:
const hasReviewers = reviewers.data.users.length > 0;
return { hasComment, hasReviewers };
core.setOutput('hasComment', hasComment);
core.setOutput('hasReviewers', hasReviewers);
outputs:
hasComment: ${{ steps.check-comment.outputs.hasComment }}
hasReviewers: ${{ steps.check-comment.outputs.hasReviewers }}

- name: Add reviewers and comment if necessary
if: steps.check-comment.outputs.hasComment == 'false' || steps.check-comment.outputs.hasReviewers == 'false'
uses: actions/github-script@v6
with:
script: |
const prNumber = context.payload.pull_request.number;
const prCreator = context.payload.pull_request.user.login;
// Add a comment if not already present
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: `@${prCreator}, core features have been modified in this pull request. Reviewers have been added.`,
});
if (!${{ steps.check-comment.outputs.hasComment }}) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: `@${prCreator}, core features have been modified in this pull request. Reviewers have been added.`,
});
}
// Add reviewers if not already present
if (!inputs.hasReviewers) {
if (!${{ steps.check-comment.outputs.hasReviewers }}) {
await github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
reviewers: ['@FredrikOseberg'], // Add your reviewers here
reviewers: ['FredrikOseberg'], // Do not include @ in reviewer names
});
}
}

0 comments on commit 72e535d

Please sign in to comment.