Skip to content

Commit

Permalink
feat: comment on pr install and build time
Browse files Browse the repository at this point in the history
  • Loading branch information
thangbuiq committed Feb 16, 2024
1 parent eeb3ba0 commit 28af5fb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 57 deletions.
26 changes: 23 additions & 3 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,31 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Setup Node.js Environment
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install Dependencies
run: |
echo "before_time=$(date +%s)" >> $GITHUB_ENV
echo "install_before_time=$(date +%s.%N)" >> $GITHUB_ENV
yarn install --frozen-lockfile
echo "install_after_time=$(date +%s.%N)" >> $GITHUB_ENV
install_time=$(python -c "print($install_after_time - $install_before_time)")
echo "installTime='$install_time'" >> $GITHUB_ENV
- name: Build Website
run: |
echo "before_time=$(date +%s.%N)" >> $GITHUB_ENV
yarn build
echo "after_time=$(date +%s)" >> $GITHUB_ENV
echo "after_time=$(date +%s.%N)" >> $GITHUB_ENV
build_time=$(python -c "print($after_time - $before_time)")
echo "buildTime='$build_time'" >> $GITHUB_ENV
- name: Verify Build Output
run: |
Expand All @@ -56,11 +67,20 @@ jobs:
with:
github-token: ${{ secrets.TOKEN_GITHUB }}
script: |
const installTime = process.env.installTime;
const buildTime = process.env.buildTime;
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 CI time: ' + (process.env.after_time - process.env.before_time) + ' seconds'
body: commentBody
});
deploy-docusaurus:
Expand Down
54 changes: 0 additions & 54 deletions .markdownlint.json

This file was deleted.

0 comments on commit 28af5fb

Please sign in to comment.