Skip to content

scrape-epa

scrape-epa #510

Workflow file for this run

name: scrape-epa
on:
workflow_dispatch:
schedule:
- cron: '17 4 * * *' # Run once a day at 4:17am
jobs:
scheduled:
runs-on: ubuntu-latest
steps:
- name: checkout repo content
uses: actions/checkout@v3 # checkout the repository content to github runner
- name: setup Bun
uses: oven-sh/setup-bun@v1
- name: Bun install npm packages
run: |
bun install
wget https://epa-rss.s3.eu-west-1.amazonaws.com/latest/epa-rss.sqlite -P sqlite
- name: bun run TS code
env:
EPA_RSS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }}
EPA_RSS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
EPA_RSS_BUCKET: ${{ secrets.AWS_BUCKET }}
run: |
bun generate_bun.ts
- name: commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A
git commit --allow-empty -m "update EPS data" -a
git push
- name: install and run feediverse for Mastodon
run: |
pip install feediverse
sed 's/MASTODON_ACCESS_TOKEN/'$MASTODON_ACCESS_TOKEN'/' .feediverse_template > /home/runner/.feediverse
sed -i 's/MASTODON_CLIENT_ID/'$MASTODON_CLIENT_ID'/' /home/runner/.feediverse
sed -i 's/MASTODON_CLIENT_SECRET/'$MASTODON_CLIENT_SECRET'/' /home/runner/.feediverse
/home/runner/.local/bin/feediverse --verbose -c /home/runner/.feediverse
rm /home/runner/.feediverse
shell: bash
env:
MASTODON_ACCESS_TOKEN: ${{secrets.MASTODON_ACCESS_TOKEN}}
MASTODON_CLIENT_ID: ${{secrets.MASTODON_CLIENT_ID}}
MASTODON_CLIENT_SECRET: ${{secrets.MASTODON_CLIENT_SECRET}}
- name: upload sqlite3 to s3
uses: shallwefootball/s3-upload-action@master
with:
aws_key_id: ${{ secrets.AWS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
aws_bucket: ${{ secrets.AWS_BUCKET }}
source_dir: 'sqlite'
destination_dir: 'latest'
- name: Get two days ago date
id: date
run: echo "twodaysago=$(date --date="2 day ago" +"%Y-%m-%d")" >> $GITHUB_OUTPUT
# run: |
# echo "::set-output name=twodaysago::$(date --date="2 day ago" +"%Y-%m-%d")"
- name: Create an issue
uses: dacbd/create-issue-action@main
with:
token: ${{ secrets.github_token }}
title: EPA Submissions for ${{ steps.date.outputs.twodaysago }}
body: |
* If any submissions, they will be here: https://github.com/EPA-Ireland-Updates-Unofficial/epa-rss/blob/main/output/csv/daily/${{ steps.date.outputs.twodaysago }}.csv
labels: |
closeme
- name: Close those automatic issues
uses: bdougie/close-issues-based-on-label@master
env:
LABEL: closeme
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}