Skip to content

Commit

Permalink
chore: update pr-build.yaml (#76)
Browse files Browse the repository at this point in the history
* chore: update pr-build.yaml

* chore: refactor pr-build.yaml

* chore: fix eof pr-build.yaml

* chore: fix unknown flag

* chore: update body comment

* chore: rename build workflow
  • Loading branch information
kimmyxpow authored Feb 19, 2024
1 parent d5e1165 commit b9fa782
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 41 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/build-openseries-web.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build OpenSeries Web

on:
pull_request:
branches:
- develop
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Build Next.js
run: |
bun install --frozen-lockfile
bun lint
bun run build
- name: Check Build Status
run: |
if [ $? -eq 0 ]; then
echo "Build successful"
else
echo "Build failed. Exiting..."
exit 1
fi
- name: Comment on Pull Request
env:
GH_TOKEN: ${{ secrets.WF_TOKEN }}
PR: ${{ github.event.pull_request.html_url }}
run: |
LAST_COMMIT_SHA="${{ github.event.pull_request.head.sha }}"
if [[ ${{ job.status }} == 'success' ]]; then
BUILD_STATUS="Berhasil🩵"
LABEL="ready to review"
SUCCESS_MESSAGE="Mohon untuk menunggu para Maintainer mereview kodemu🎉!"
REMOVAL_LABEL="invalid"
else
BUILD_STATUS="Gagal💔"
LABEL="invalid"
SUCCESS_MESSAGE="Sepertinya ada kesalahan dalam kode yang menyebabkan kegagalan build. Coba jalankan `bun run build` di localmu. Silahkan perbaiki terlebih dahulu😼!"
REMOVAL_LABEL="ready to review"
fi
COMMENT_BODY=$(cat <<EOF
## Building Website OpenSeries😍
Build untuk pull request ini $BUILD_STATUS. $SUCCESS_MESSAGE
| Commit | Status |
|-------------|-----------|
| $LAST_COMMIT_SHA | $BUILD_STATUS |
EOF
)
gh pr edit $PR --add-label "$LABEL"
gh pr edit $PR --remove-label "$REMOVAL_LABEL"
gh pr comment $PR --body "$COMMENT_BODY"
41 changes: 0 additions & 41 deletions .github/workflows/pr-build.yaml

This file was deleted.

0 comments on commit b9fa782

Please sign in to comment.