tardis-research-papers #3
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: tardis-research-papers | |
on: | |
schedule: | |
- cron: "0 0 1 * *" | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash -l {0} | |
env: | |
NASA_ADS_TOKEN: ${{ secrets.NASA_ADS_TOKEN }} | |
jobs: | |
research-using-tardis: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup micromamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-name: fetch-env | |
create-args: >- | |
python=3.10 | |
jupyter | |
- name: Run the ADS notebook | |
run: | | |
jupyter nbconvert --to python docs/resources/research_done_using_TARDIS/ads.ipynb | |
python3 docs/resources/research_done_using_TARDIS/ads.py | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: research_papers | |
path: | | |
resource_papers.rst | |
pull_request: | |
needs: [research-using-tardis] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
path: /tmp | |
- name: Copy files to repository | |
run: | | |
ls -l /tmp | |
cp -r /tmp/research_papers/* docs/resources/research_done_using_TARDIS/ | |
- name: Get current date | |
run: echo "DATE=$(date +'%Y.%m.%d')" >> $GITHUB_ENV | |
- uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.BOT_TOKEN }} | |
committer: TARDIS Bot <tardis.sn.bot@gmail.com> | |
author: TARDIS Bot <tardis.sn.bot@gmail.com> | |
branch: TARDIS-research-papers-${{ env.DATE }} | |
base: master | |
push-to-fork: tardis-bot/tardis | |
commit-message: Automated changes for TARDIS-research-papers ${{ env.DATE }} | |
title: TARDIS-research-papers ${{ env.DATE }} | |
body: | | |
*\*beep\* \*bop\** | |
Hi, human. | |
> This pull request contains the latest updates to the research papers that utilize the TARDIS. | |
> This pull request should be auto-merged. | |
labels: automated, build-docs | |
team-reviewers: tardis-infrastructure | |
id: create-pr | |
- name: Wait for pull request | |
run: sleep 30 | |
- name: Approve pull request (I) | |
run: gh pr review ${{ steps.create-pr.outputs.pull-request-number }} --approve | |
env: | |
GITHUB_TOKEN: ${{ secrets.INFRASTRUCTURE_COORDINATOR_TOKEN }} | |
if: steps.create-pr.outputs.pull-request-operation == 'created' | |
- name: Approve pull request (II) | |
run: gh pr review ${{ steps.create-pr.outputs.pull-request-number }} --approve | |
env: | |
GITHUB_TOKEN: ${{ secrets.CORE_COORDINATOR_TOKEN }} | |
if: steps.create-pr.outputs.pull-request-operation == 'created' | |
- name: Enable automerge | |
uses: peter-evans/enable-pull-request-automerge@v2 | |
with: | |
token: ${{ secrets.INFRASTRUCTURE_COORDINATOR_TOKEN }} | |
pull-request-number: ${{ steps.create-pr.outputs.pull-request-number }} | |
merge-method: squash | |
if: steps.create-pr.outputs.pull-request-operation == 'created' | |
dispatch-to-tardis-website: | |
name: Dispatch to Tardis Website | |
runs-on: ubuntu-latest | |
needs: [research-using-tardis] | |
if: github.repository_owner == 'tardis-sn' | |
steps: | |
- name: Dispatch to Tardis-org-data | |
run: | | |
curl -X POST \ | |
-H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Content-Type: application/json" \ | |
-d '{ "event_type": "fetch-papers" }' \ | |
https://api.github.com/repos/tardis-sn/tardis-org-data/dispatches |