Booking Action #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Booking Action | |
env: | |
ED_USERNAME: ${{ secrets.ED_USERNAME }} | |
ED_PASSWORD: ${{ secrets.ED_PASSWORD }} | |
CAPTCHA_API_KEY: ${{ secrets.CAPTCHA_API_KEY }} | |
SIGN_IN_URL: ${{ vars.SIGN_IN_URL }} | |
DUMMY_BOOKING_URL: ${{ vars.DUMMY_BOOKING_URL }} | |
BOOKING_URL: ${{ vars.BOOKING_URL }} | |
RETRY_INTERVAL: ${{ vars.RETRY_INTERVAL }} | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow at a certain time | |
schedule: | |
- cron: '50 17 * * 4' | |
- cron: '50 17 * * 3' | |
- cron: '50 17 * * 2' | |
- cron: '50 17 * * 0' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
add-persons: | |
strategy: | |
fail-fast: false | |
matrix: | |
person: ${{ fromJson(vars.PERSONS) }} | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
# Setup Node | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: 'package.json' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci --prefer-offline --no-audit | |
- uses: amplium/git-crypt-action@master | |
with: | |
key_encoded: ${{ secrets.DECRYPTION_SECRET }} | |
# Runs Puppeteer | |
- name: Run Puppeteer | |
run: export PERSON="${{ matrix.person }}" && node add-to-cart.mjs | |
# Encrypt screenshot files | |
- name: Encrypt Tar | |
run: | | |
tar -czvf "screenshot-${{ matrix.person }}.tar.gz screenshot-${{ matrix.person }}.png" "screenshot-final-${{ matrix.person }}.png" | |
gpg --batch -c --passphrase ${{ secrets.ARTIFACT_ENCRYPTION_PASS }} "screenshots-${{ matrix.person }}.tar.gz" | |
# Uploads results | |
- name: Upload Screenshots | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: Screenshots | |
path: screenshots-${{ matrix.person }}.tar.gz.gpg |