Skip to content

Merge pull request #79 from BugAlertDotOrg/Confluence2023 #95

Merge pull request #79 from BugAlertDotOrg/Confluence2023

Merge pull request #79 from BugAlertDotOrg/Confluence2023 #95

Workflow file for this run

name: Files Added Hook
on:
# Trigger the workflow on push or pull request,
# but only for the master branch
push:
branches:
- main
paths:
- 'content/notices/*'
env:
TEXT_EM_ALL_ID: ${{ secrets.TEXT_EM_ALL_ID }}
TEXT_EM_ALL_SECRET: ${{ secrets.TEXT_EM_ALL_SECRET }}
TEXT_EM_ALL_TOKEN: ${{ secrets.TEXT_EM_ALL_TOKEN }}
GCP_KEY: ${{ secrets.GCP_KEY }}
API_KEY: ${{ secrets.API_KEY }}
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
TWITTER_BEARER_TOKEN: ${{ secrets.TWITTER_BEARER_TOKEN }}
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}
TELEGRAM_API_KEY: ${{ secrets.TELEGRAM_API_KEY }}
jobs:
build:
runs-on: ubuntu-latest
environment: bugalert-invoke-lambda
steps:
- uses: actions/checkout@v2
- id: files
uses: jitterbit/get-changed-files@v1
with:
format: 'json'
- run: |
ls -ltah "${GITHUB_WORKSPACE}"
sudo apt-get update && sudo apt-get install python3-pip -y
pip3 install -Ur "${GITHUB_WORKSPACE}/notice_communication/requirements.txt"
readarray -t added_files <<<"$(jq -r '.[]' <<<'${{ steps.files.outputs.added }}')"
for added_file in ${added_files[@]}; do
if [[ $added_file == content/notices/* ]]; then
echo "File added: ${added_file}. Sleeping for two minutes to await the Pelican build."
sleep 120
python3 "${GITHUB_WORKSPACE}/notice_communication/__main__.py" "${added_file}"
fi
done