ci: add notify-failure, deploy tagging, and jest coverage
Lint / JS (eslint) (push) Successful in 11s
Test / JS Tests (jest) (push) Successful in 10s
Lint / Notify on failure (push) Has been skipped
Lint / Deploy (push) Successful in 2s
Security / JS Security (npm audit) (push) Successful in 10s

- lint.yml: add notify-failure Matrix alert job; add Tag deployed commit
  step to deploy job with deploy-YYYY.MM.DD-N tagging via Gitea API
- package.json: add --coverage flag to jest test script

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-14 16:25:12 -04:00
parent 162ca5f7a7
commit 53b61249b0
2 changed files with 32 additions and 1 deletions
+31
View File
@@ -19,11 +19,31 @@ jobs:
- name: Run ESLint - name: Run ESLint
run: npx eslint --ext .js . run: npx eslint --ext .js .
notify-failure:
name: Notify on failure
runs-on: ubuntu-latest
needs: [js-lint]
if: failure() && github.event_name == 'push'
steps:
- name: Send Matrix alert
env:
MATRIX_WEBHOOK_URL: ${{ secrets.MATRIX_WEBHOOK_URL }}
REPO: ${{ github.repository }}
BRANCH: ${{ github.ref_name }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
if [ -z "$MATRIX_WEBHOOK_URL" ] || [ "$MATRIX_WEBHOOK_URL" = "CONFIGURE_ME" ]; then exit 0; fi
curl -sf -X POST "$MATRIX_WEBHOOK_URL" \
-H "Content-Type: application/json" \
-d "{\"text\":\"CI FAILED: ${REPO} @ ${BRANCH} — ${RUN_URL}\"}"
deploy: deploy:
name: Deploy name: Deploy
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [js-lint] needs: [js-lint]
if: github.event_name == 'push' && github.ref == 'refs/heads/main' if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: write
steps: steps:
- name: Trigger webhook - name: Trigger webhook
env: env:
@@ -38,3 +58,14 @@ jobs:
-H "X-Gitea-Signature: ${SIG}" \ -H "X-Gitea-Signature: ${SIG}" \
-d "$PAYLOAD" \ -d "$PAYLOAD" \
"http://10.10.10.65:9000/hooks/pulse-deploy" "http://10.10.10.65:9000/hooks/pulse-deploy"
- name: Tag deployed commit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="deploy-$(date -u +%Y.%m.%d)-${{ github.run_number }}"
curl -sf -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"${TAG}\",\"target\":\"${{ github.sha }}\",\"message\":\"Deployed to production\"}" \
"https://code.lotusguild.org/api/v1/repos/${{ github.repository }}/tags"
+1 -1
View File
@@ -3,7 +3,7 @@
"version": "1.0.0", "version": "1.0.0",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "jest" "test": "jest --coverage"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",