.github/workflows/nexus-trusted-traveler-scheduler-1a.yml #1352
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
## Docs: | |
## * https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-pull_request-workflow-when-a-pull-request-merges | |
## | |
name: "nexus 1a" | |
on: | |
# Push is for testing only to allow you to test this workflow without | |
# a merge and just a push. | |
# push: | |
# pull_request: | |
# types: | |
# - closed | |
# branches: | |
# - main | |
## Schedule doc: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule | |
## ┌───────────── minute (0 - 59) | |
## │ ┌───────────── hour (0 - 23) | |
## │ │ ┌───────────── day of the month (1 - 31) | |
## │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) | |
## │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) | |
## │ │ │ │ │ | |
## │ │ │ │ │ | |
## │ │ │ │ │ | |
## * * * * * | |
schedule: | |
# ## Testing run every 5 minutes | |
# - cron: '*/5 * * * *' | |
## Run every 20 mins or so | |
- cron: '*/20 * * * *' | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_NEXUS }} # Sends to the nexus channel. In the format of: slack://xxx/xxx/xxx | |
# Enable debug output | |
# DEBUG: false | |
jobs: | |
check_open_reservations: | |
# if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
## Set the max time to run this job | |
## https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes | |
## Github Action has a 6 hour limit on how long you can run a job for. We will set this number to something less than that | |
## and about half of that to be safe. Then we are setting the cron above to re-run this job every 2-3 hours or so. There | |
## will be some overlap, which I think is ok to have two of these things running at the same time. That will give us coverage | |
## while one is shutting down and the other is starting up. | |
# timeout-minutes: 80 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run | |
run: | | |
ls -l | |
cd nexus-global-entry/trusted-traveler-scheduler/trusted-traveler-scheduler | |
python3 -m venv my_env | |
source my_env/bin/activate | |
pip3 install -r requirements.txt | |
ls -l | |
echo "python3 ttp.py -u ${{ secrets.SLACK_BOT_TOKEN_NEXUS }}" | |
timeout 15m python3 ttp.py -u "${{ secrets.SLACK_BOT_TOKEN_NEXUS }}" -r 3m | |
echo "Finished and exiting" |