monthly_import #86
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: monthly_import | |
on: | |
schedule: | |
- cron: '* * 1 * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
python -c "import sys; print('Python version:',sys.version)" | |
- name: Get current date | |
id: date | |
run: | | |
echo "BRANCH_NAME=import-$(date +'%Y-%m-%d-%H-%M')" >> $GITHUB_ENV | |
- name: Test with environment variables | |
run: echo "$BRANCH_NAME" | |
- name: Cleanup branches if needed | |
id: cleanup-branches | |
continue-on-error: true | |
run: | | |
if git show-ref --verify --quiet "refs/heads/${{ env.BRANCH_NAME }}"; then | |
git branch -D ${{ env.BRANCH_NAME }} | |
fi | |
- name: Setup branch | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git checkout -b ${{ env.BRANCH_NAME }} | |
- name: Import arXiv | |
continue-on-error: true | |
run: | | |
python ./import_arxiv_2021.py && git diff | |
git diff --quiet || { git add -A && git commit -m "Imported arXiv";} | |
- name: Import M.Sc. theses | |
continue-on-error: true | |
run: | | |
python ./import_repository.py && git diff | |
git diff --quiet || { git add -A && git commit -m "Imported repository"; } | |
- name: Import PURE - CS | |
continue-on-error: true | |
run: | | |
python ./import_pure_2021.py && git diff | |
git diff --quiet || { git add -A && git commit -m "Imported PURE"; } | |
- name: Filter papers and website export | |
continue-on-error: true | |
run: | | |
python ./filter_pure_mavlab.py && git diff | |
git diff --quiet || { git add -A && git commit -m "Filtered MAVLab papers from PURE"; } | |
python ./filter_arxiv.py && git diff | |
git diff --quiet || { git add -A && git commit -m "Filtered arXiv papers"; } | |
make -C ./website | |
git clean -df | |
git diff --quiet || { git add -A && git commit -m "Updated list of papers for website"; } | |
python ./filter_delfly.py && git diff | |
python ./filter_by_user.py && git diff | |
- name: Commit and Push changes | |
run: | | |
git diff --quiet || { git add -A && git commit -m "Updated list of papers: ${{ env.BRANCH_NAME }}" && git push https://$USERNAME:[email protected]/tudelft/publications.git ${{ env.BRANCH_NAME }}; } | |
env: | |
REPO_KEY: ${{secrets.PUSH_TOKEN}} | |
USERNAME: github-actions[bot] | |
- name: Make PR | |
uses: devops-infra/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
source_branch: ${{ env.BRANCH_NAME }} | |
target_branch: master | |
title: Monthly Paper Update ${{ env.BRANCH_NAME }} | |
body: "**Automated pull request**" | |
old_string: "<!-- Monthly Paper Update ${{ env.BRANCH_NAME }} -->" | |
new_string: "** Monthly Paper Update ${{ env.BRANCH_NAME }} **" | |
get_diff: true |