ApplSec bot #24534
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: ApplSec bot | |
on: | |
schedule: | |
# UTC - default and not changeable, https://github.com/orgs/community/discussions/13454 | |
# midnight | |
- cron: "0 0 * * *" | |
# every second hour | |
- cron: "0 */2 * * *" | |
# between 4 and 8 pm UTC on weekdays run every 15 minutes as that is the time when updates usually get released | |
- cron: "*/15 16-20 * * 1-5" | |
workflow_dispatch: | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main | |
uses: actions/checkout@v4 | |
with: | |
path: main | |
- name: Checkout posted_data_json | |
uses: actions/checkout@v4 | |
with: | |
ref: posted_data_json | |
path: branch | |
- name: Set up posted_data.json | |
run: | | |
cp branch/posted_data.json main/src/ | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.13" | |
cache: "pip" | |
- name: Install dependencies | |
run: | | |
pip install -r main/requirements.txt | |
- name: Set Timezone to America/Los_Angeles | |
run: | | |
sudo timedatectl set-timezone "America/Los_Angeles" | |
- name: Run ApplSec bot | |
env: | |
TWITTER_API_KEY: ${{ secrets.TWITTER_API_KEY }} | |
TWITTER_API_KEY_SECRET: ${{ secrets.TWITTER_API_KEY_SECRET }} | |
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} | |
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} | |
TWITTER_API_KEY_TEST: ${{ secrets.TWITTER_API_KEY_TEST }} | |
TWITTER_API_KEY_SECRET_TEST: ${{ secrets.TWITTER_API_KEY_SECRET_TEST }} | |
TWITTER_ACCESS_TOKEN_TEST: ${{ secrets.TWITTER_ACCESS_TOKEN_TEST }} | |
TWITTER_ACCESS_TOKEN_SECRET_TEST: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET_TEST }} | |
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }} | |
MASTODON_ACCESS_TOKEN_TEST: ${{ secrets.MASTODON_ACCESS_TOKEN_TEST }} | |
BLUESKY_HANDLE: ${{ secrets.BLUESKY_HANDLE }} | |
BLUESKY_PASSWORD: ${{ secrets.BLUESKY_PASSWORD }} | |
run: | | |
python main/src/main.py | |
- name: Save posted_data.json | |
if: always() | |
run: | | |
cd branch/ | |
cp ../main/src/posted_data.json . | |
if [[ $(git status --porcelain) ]]; then | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add . | |
git diff --staged --quiet || git commit -m "$(date +'%Y-%m-%d %I:%M:%S %p %z')" && git push | |
fi |