Docs auto update #8
Workflow file for this run
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 CSV and Commit | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- pulsar_spectra/catalogue.py | |
pull_request: | |
paths: | |
- pulsar_spectra/catalogue.py | |
jobs: | |
update-csv: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install python dependencies | |
run: | | |
pip install . | |
- name: Run Update Script | |
run: | | |
cd docs | |
python get_ref_number_freq_range.py | |
- name: Commit Changes | |
run: | | |
git config --global user.email "actions@github.com" | |
git config --global user.name "GitHub Actions" | |
timestamp=$(date +'%Y%m%d%H%M%S') | |
branch_name="update-csv-$timestamp" | |
git checkout -b "$branch_name" | |
git add docs/papers_in_catalogue.csv | |
git commit -m "Update papers_in_catalogue.csv file [skip ci]" || true | |
git push origin "$branch_name" | |
git remote update | |
git fetch | |
git checkout --track origin/${BRANCH_NAME} | |
git merge --no-ff "$branch_name" | |
git push origin ${BRANCH_NAME} | |
# delete the temporary branch | |
git branch -d "$branch_name" | |
git push origin --delete "$branch_name" |