Security / JS Security (npm audit) (push) Failing after 15s
Lint / JS (eslint) (push) Successful in 16s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Lint / JS (eslint) (pull_request) Successful in 13s
Lint / Notify on failure (pull_request) Skipped
Test / JS Tests (jest) (push) Successful in 15s
Lint / Deploy (pull_request) Skipped
Test / JS Tests (jest) (pull_request) Successful in 17s
Security / JS Security (npm audit) (pull_request) Failing after 20s
Replace every em dash and en dash outside user-visible UI text with a colon, comma, hyphen or "to". The UI strings and the vendored web_template are handled separately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
72 lines
2.3 KiB
YAML
72 lines
2.3 KiB
YAML
name: Lint
|
|
|
|
on:
|
|
push:
|
|
branches: ["**"]
|
|
pull_request:
|
|
branches: ["**"]
|
|
|
|
jobs:
|
|
js-lint:
|
|
name: JS (eslint)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install ESLint
|
|
run: npm install --save-dev eslint@8
|
|
|
|
- name: Run ESLint
|
|
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:
|
|
name: Deploy
|
|
runs-on: ubuntu-latest
|
|
needs: [js-lint]
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Trigger webhook
|
|
env:
|
|
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }}
|
|
GIT_REF: ${{ github.ref }}
|
|
run: |
|
|
PAYLOAD="{\"ref\":\"${GIT_REF}\"}"
|
|
SIG=$(echo -n "$PAYLOAD" | openssl dgst -sha256 -hmac "$WEBHOOK_SECRET" | awk '{print $2}')
|
|
curl -sf --connect-timeout 10 \
|
|
-X POST \
|
|
-H "Content-Type: application/json" \
|
|
-H "X-Gitea-Signature: ${SIG}" \
|
|
-d "$PAYLOAD" \
|
|
"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"
|