Skip to content

Commit

Permalink
fix: pr comment 작성 및 수정 방식 교체
Browse files Browse the repository at this point in the history
  • Loading branch information
hanyugeon committed May 30, 2024
1 parent 9644d82 commit de80c77
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 18 deletions.
34 changes: 17 additions & 17 deletions .github/actions/get-score-comments/action.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// const core = require('@actions/core');
const core = require('@actions/core');
console.log('꼽냐?');

try {
Expand Down Expand Up @@ -97,23 +97,23 @@ try {
)}${unit} |\n`;
});

// // comments 내보내기
// core.setOutput('comments', comments);
// comments 내보내기
core.setOutput('comments', comments);

// Comment 작성
if (comments && context.issue.number) {
const issue_number = context.issue.number;
const repo = context.repo.repo;
const owner = context.repo.owner;
github.issues.createComment({
owner,
repo,
issue_number,
body: comments,
});
} else {
console.log('No PR COMMENT!');
}
// // Comment 작성
// if (comments && context.issue.number) {
// const issue_number = context.issue.number;
// const repo = context.repo.repo;
// const owner = context.repo.owner;
// github.issues.createComment({
// owner,
// repo,
// issue_number,
// body: comments,
// });
// } else {
// console.log('No PR COMMENT!');
// }
} catch (error) {
console.error(error);
}
23 changes: 22 additions & 1 deletion .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: LightHouse CI

on: [push]
on:
pull_request:
branches:
- main

jobs:
lhci:
Expand Down Expand Up @@ -32,3 +35,21 @@ jobs:
- name: Get Score Comments
id: get-score-comments
uses: ./.github/actions/get-score-comments

- name: Find Comment
if: github.event_name == 'pull_request'
uses: peter-evans/find-comment@v2
id: find_comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: ⚡️ Lighthouse Average Scores Across Reports

- name: Create or update comment
if: github.event_name == 'pull_request'
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.get-score-comments.outputs.comments }}
edit-mode: replace

0 comments on commit de80c77

Please sign in to comment.