Updating archives list and tool version #10
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: update-archives-list-pr | |
run-name: Updating archives list and tool version | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 0' | |
jobs: | |
run-archive-script: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: install python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: install pyvo and required dependencies | |
run: | | |
python -m ensurepip --upgrade | |
pip install astropy | |
pip install requests | |
pip install pyvo | |
- name: create temp PR branch | |
run: | | |
DATE=$(date +'%Y%m%d') | |
BRANCH_NAME="archives-update-pr-${DATE}" | |
git checkout -b $BRANCH_NAME | |
git push origin $BRANCH_NAME | |
git push --set-upstream origin archives-update-pr-${DATE} | |
- name: run archives script | |
run: | | |
python fetch_archives.py | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add . | |
git commit -m "updated archives file" | |
git push | |
- name: List files after script execution | |
run: ls -la | |
- name: create pull request | |
run: | | |
HAS_COMMITS=$(git rev-list --count HEAD ^origin/main) | |
if [ "$HAS_COMMITS" -gt 0 ]; then | |
python update_tool_version.py | |
git add . | |
git commit -m "updated tool version" | |
git push | |
DATE=$(date +'%Y%m%d') | |
BRANCH_NAME="archives-update-pr-${DATE}" | |
gh pr create -B main -H $BRANCH_NAME --title 'Archives list update' --body 'Automated pull request for archives list update' | |
else | |
echo "No modifications in available archives" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |