Check new xls version #108
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Check new xls version | |
on: | |
# push: | |
# branches: | |
# - main | |
schedule: | |
# Lets run it every 24 hours | |
- cron: '0 0 * * *' | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
pip install jupyter | |
- name: Run the notebook | |
run: | | |
jupyter execute Download.ipynb | |
- name: If there are changes, create a PR | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
# Lets check for any PR with the label satupdate | |
# If there is one, we would just add a comment | |
# If there is none, we would create a PR | |
if [ -z "$(gh pr list --label satupdate)" ]; then | |
echo "No PR with label satupdate" | |
else | |
echo "PR with label satupdate" | |
# Get the PR number | |
pr_number=$(gh pr list --label satupdate | grep -oP '(?<=#)\d+') | |
# Add a comment | |
gh pr comment $pr_number --body "Update xls" | |
exit 0 | |
fi | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "GitHub Actions" | |
git checkout -b update-xls | |
git add . | |
git commit -m "Update xls" | |
git push origin update-xls --force | |
# Assign to okvic77 | |
# Create the tag satupdate | |
gh pr create --title "Update xls" --body "Update xls" --base main --head update-xls --assignee okvic77 --label satupdate | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |