refactor: enhance webhook notifications for quality checks and package publishing
Some checks failed
Publish to npm / quality (push) Successful in 25s
Publish to npm / failed-webhook (push) Has been skipped
Publish to npm / publish (push) Failing after 25s

This commit is contained in:
Astrian Zheng 2025-05-21 16:18:02 +10:00
parent 6944b365d2
commit ea236c385e
Signed by: Astrian
SSH Key Fingerprint: SHA256:rVnhx3DAKjujCwWE13aDl7uV6+9U1MvydLkNRXJrBiA

View File

@ -20,6 +20,22 @@ jobs:
run: npm ci run: npm ci
- name: Run Biome - name: Run Biome
run: npm run quality-check run: npm run quality-check
if: always()
outputs:
status: ${{ job.status }}
failed-webhook:
needs: quality
runs-on: ubuntu-latest
if: ${{ needs.quality.outputs.status == 'failure' }}
steps:
- name: Send webhook
run: |
QUALITY_CHECK_GROUP="Laterano CI/CD"
QUALITY_CHECK_TITLE="Quality Check Failed"
QUALITY_CHECK_MESSAGE="Quality check failed for commit ${{ gitea.sha }} in ${{ gitea.repository }}"
curl -X POST "https://bark.nas.astrian.moe/${{ secrets.BARK_TOKEN }}/${QUALITY_CHECK_TITLE}/${QUALITY_CHECK_MESSAGE}?group=${QUALITY_CHECK_GROUP}"
publish: publish:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -58,3 +74,11 @@ jobs:
run: npm publish --access $ACCESS_LEVEL run: npm publish --access $ACCESS_LEVEL
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Send webhook
run: |
PACKAGE_NAME="${{ steps.package_name.outputs.PACKAGE_NAME }}"
MSG_GROUP="Laterano CI/CD"
MSG_TITLE="Package Published"
MSG_MESSAGE="Package $PACKAGE_NAME has been published to npm."
curl -X POST "https://bark.nas.astrian.moe/${{ secrets.BARK_TOKEN }}/${MSG_TITLE}/${MSG_MESSAGE}?group=${MSG_GROUP}"