Skip to content

Commit

Permalink
feat: comment a table on PR
Browse files Browse the repository at this point in the history
  • Loading branch information
thangbuiq committed Feb 16, 2024
1 parent 6298324 commit a5520a6
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,6 @@ jobs:
yarn install --frozen-lockfile
echo "install_after_time=$(date +%s)" >> $GITHUB_ENV
- name: Comment Install Time on Pull Request
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.TOKEN_GITHUB }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '✅ Dependencies installed successfully with total time: ' + (process.env.install_after_time - process.env.install_before_time) + ' seconds'
});
- name: Build Website
run: |
echo "before_time=$(date +%s)" >> $GITHUB_ENV
Expand Down Expand Up @@ -71,11 +58,20 @@ jobs:
with:
github-token: ${{ secrets.TOKEN_GITHUB }}
script: |
const installTime = process.env.install_after_time - process.env.install_before_time;
const buildTime = process.env.after_time - process.env.before_time;
const table = `
| Step | Time (seconds) |
|----------------------|----------------|
| Install Dependencies | ${installTime} |
| Build Website | ${buildTime} |
`;
const commentBody = `✅ Test server functionality passed with the following times for each step:\n\n${table}`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '✅ Test server functionality passed with total build time: ' + (process.env.after_time - process.env.before_time) + ' seconds'
body: commentBody
});
deploy-docusaurus:
Expand Down

0 comments on commit a5520a6

Please sign in to comment.