-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ccd5ec7
Showing
5 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Generate feed | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 10 * * 2" | ||
|
||
jobs: | ||
generate-data: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10' | ||
- name: Install dependencies | ||
run: pip install -r requirements.txt | ||
- name: Generate feed | ||
run: python script.py | ||
- name: Commit results | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
git add feed.rss | ||
git commit -m "Update feed" | ||
git push |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<rss><channel><pubDate>Tue, 23 Jul 2024 23:55:21 -0000</pubDate><item><title>https://invertebase.org/portal/content/dwca/DMNH-Mollusk_DwC-A.zip</title><link>https://invertebase.org/portal/content/dwca/DMNH-Mollusk_DwC-A.zip</link><ipt:dwca>https://invertebase.org/portal/content/dwca/DMNH-Mollusk_DwC-A.zip</ipt:dwca><pubDate>Tue, 23 Jul 2024 23:55:21 -0000</pubDate></item><item><title>https://invertebase.org/portal/content/dwca/ANSP-MAL_DwC-A.zip</title><link>https://invertebase.org/portal/content/dwca/ANSP-MAL_DwC-A.zip</link><ipt:dwca>https://invertebase.org/portal/content/dwca/ANSP-MAL_DwC-A.zip</ipt:dwca><pubDate>Tue, 23 Jul 2024 23:55:21 -0000</pubDate></item></channel></rss> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
python-dateutil |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from email.utils import format_datetime | ||
from datetime import datetime | ||
|
||
|
||
pubdate = format_datetime(datetime.now()) | ||
output = f"<rss><channel><pubDate>{pubdate}</pubDate>" | ||
|
||
endpoints = [ | ||
"https://invertebase.org/portal/content/dwca/DMNH-Mollusk_DwC-A.zip", | ||
"https://invertebase.org/portal/content/dwca/ANSP-MAL_DwC-A.zip" | ||
] | ||
|
||
for endpoint in endpoints: | ||
output = output + f"<item><title>{endpoint}</title><link>{endpoint}</link><ipt:dwca>{endpoint}</ipt:dwca><pubDate>{pubdate}</pubDate></item>" | ||
|
||
output = output + "</channel></rss>" | ||
|
||
file = open("feed.rss", "w") | ||
file.write(output) | ||
file.close() |