Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,50 @@ jobs:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

notify:
needs: [build, deploy]
if: always()
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Resolve actor name
id: resolve_actor
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const developers = JSON.parse(fs.readFileSync(`${{ github.workspace }}/.github/workflows/reviewer.json`));
const matched = developers.reviewers.find(p => p.githubName === '${{ github.actor }}');
core.setOutput('actorName', JSON.stringify(matched?.name ?? '${{ github.actor }}'));

- name: Send Slack Notification
env:
ACTOR_RAW: ${{ fromJSON(steps.resolve_actor.outputs.actorName) }}
COMMIT_MSG_RAW: ${{ github.event.head_commit.message || '' }}
run: |
if [[ "${{ needs.build.result }}" != "success" ]]; then
STATUS="${{ needs.build.result }}"
else
STATUS="${{ needs.deploy.result }}"
fi
ENVIRONMENT=$([[ "${{ github.ref_name }}" == "main" ]] && echo "Production" || echo "Stage")
COMMIT_MSG=$(printf '%s\n' "$COMMIT_MSG_RAW" | head -1)
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
ACTOR="$ACTOR_RAW"

BODY=$(jq -n \
--arg status "$STATUS" \
--arg environment "$ENVIRONMENT" \
--arg repository "${{ github.repository }}" \
--arg branch "${{ github.ref_name }}" \
--arg actor "$ACTOR" \
--arg commitMessage "$COMMIT_MSG" \
--arg runUrl "$RUN_URL" \
'{status: $status, environment: $environment, repository: $repository, branch: $branch, actor: $actor, commitMessage: $commitMessage, runUrl: $runUrl}')

curl -X POST https://api-slack.internal.bcsdlab.com/api/deploy/frontend \
-H 'Content-Type: application/json' \
-d "$BODY"
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
},
"dependencies": {
"clsx": "^2.1.1",
"next": "16.1.6",
"react": "19.2.4",
"react-dom": "19.2.4",
"next": "16.2.3",
"react": "19.2.5",
"react-dom": "19.2.5",
"swiper": "^12.0.3"
},
"devDependencies": {
Expand Down
Loading
Loading