Skip to content

Commit

Permalink
ci: attempt to fix the changes requested comment flow
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Dec 4, 2023
1 parent 9fb74bc commit 96cb2d5
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/automation_request_changes_message.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
types: [submitted]

jobs:
comment:
check:
runs-on: ubuntu-latest
steps:
- name: Check Previous Reviews
id: check
id: result
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -22,16 +22,22 @@ jobs:
});
const changesRequestedReviews = reviews.data.filter((review) => review.state === 'CHANGES_REQUESTED');
const firstTimeChangesRequested = changesRequestedReviews.length === 1;
return firstTimeChangesRequested;
// Set firstTimeChangesRequested as output of this step
core.setOutput("firstTimeChangesRequested", firstTimeChangesRequested)
comment:
needs: check
runs-on: ubuntu-latest
steps:
- name: Comment on PR
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const runPreviousCheckStep = steps.check.outputs.result
const pr = context.payload.pull_request;
if (runPreviousCheckStep === 'true') {
// Get output from previous 'check' step
const firstTimeChangesRequested = needs.check.outputs.firstTimeChangesRequested
if (firstTimeChangesRequested === 'true') {
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down

0 comments on commit 96cb2d5

Please sign in to comment.