Skip to content

Commit

Permalink
merge script into "comment_tf_output" due to overlap of concerns
Browse files Browse the repository at this point in the history
Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>
  • Loading branch information
rdhar committed May 15, 2024
1 parent 33a2a28 commit 5b7adb2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 25 deletions.
11 changes: 0 additions & 11 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -354,17 +354,6 @@ runs:
retries: 3
script: await require(`${process.env.GITHUB_ACTION_PATH}/scripts/remove_reaction.js`)({ github, context });

# On pull_request, update check status with the job summary before exiting.
- name: Update check status
if: ${{ (success() || failure()) && steps.pr_comment.outcome == 'success' }}
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
env:
check_id: ${{ steps.pr_comment.outputs.check_id }}
tf_summary: ${{ steps.pr_comment.outputs.summary }}
with:
retries: 3
script: await require(`${process.env.GITHUB_ACTION_PATH}/scripts/update_check_status.js`)({ github, context });

# On issue_comment, update commit status with the job status before exiting.
- name: Update commit status
if: ${{ (success() || failure()) && github.event.issue.pull_request }}
Expand Down
10 changes: 9 additions & 1 deletion scripts/comment_tf_output.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@ ${process.env.tf_fmt}
const matrix = JSON.parse(process.env.matrix);
const job_name = `${context.job}${matrix ? ` (${Object.values(matrix).join(", ")})` : ""}`;
const check_url = workflow_run.jobs.find((job) => job.name === job_name).html_url;
core.setOutput("check_id", workflow_run.jobs.find((job) => job.name === job_name).id);
const check_id = workflow_run.jobs.find((job) => job.name === job_name).id;

// Update the check status with TF output summary.
const update_check_status = await github.rest.checks.update({
check_run_id: check_id,
output: { title: comment_summary },
owner: context.repo.owner,
repo: context.repo.repo,
});

// Display the: TF command, TF output, and workflow authorip.
const comment_output = `
Expand Down
13 changes: 0 additions & 13 deletions scripts/update_check_status.js

This file was deleted.

0 comments on commit 5b7adb2

Please sign in to comment.