name: Lint on: push: branches: ["**"] pull_request: branches: ["**"] jobs: python-lint: name: Python (flake8) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Install Python and flake8 run: | apt-get update -qq apt-get install -y -qq python3 python3-pip pip3 install flake8 - name: Run flake8 run: flake8 . --exclude=__pycache__,.git 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 static/ deploy: name: Deploy runs-on: ubuntu-latest needs: [python-lint, js-lint] if: github.event_name == 'push' && github.ref == 'refs/heads/main' 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.61:9000/hooks/gandalf-deploy"