Skip to content

modify action code

modify action code #4

Workflow file for this run

name: Trigger Verifier on Commit
on:
push:
branches:
- main
jobs:
send-post-request:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python and Install pyotp
run: |
python3 -m venv venv
source venv/bin/activate
pip install pyotp
- name: Generate TOTP Code
id: generate_totp
run: |
echo "SECRET_KEY=${{ secrets.SECRET_KEY }}" >> $GITHUB_ENV
echo "import pyotp; print(pyotp.TOTP('${{ secrets.SECRET_KEY }}').now())" > totp.py
TOTP_CODE=$(venv/bin/python3 totp.py)
echo "code=$TOTP_CODE" >> $GITHUB_ENV
- name: Send POST request to Verifier
run: |
curl -X POST "${{ secrets.FLASK_VERIFIER_URL }}/verify" \
-d "code=${{ env.code }}"