Skip to content

Check for new SLURM version #232

Check for new SLURM version

Check for new SLURM version #232

name: "Check for new Slurm version"
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
new-version:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: checkout repo
uses: actions/checkout@v3
- name: set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: install dependencies
run: |
python -m pip install --upgrade pip
pip install bs4
pip install requests
- name: check for new version
env:
GH_TOKEN: ${{ github.token }}
id: check
run: |
proceed=0
PYTHONPATH=src tests/integration/docker-slurm/new-version.py -c --check
if [ -f tests/integration/docker-slurm/latest_version ]; then
latest_version=$(cat tests/integration/docker-slurm/latest_version)
echo "latest_version=${latest_version}" >> $GITHUB_OUTPUT
if [ $(gh pr list --search "slurm $latest_version }} in:title" | wc -l) -eq 0 ]; then
echo "no existing PR"
if [ $(git branch -r | grep "slurm_${latest_version}" | wc -l) -eq 0 ]; then
echo "no existing branch"
proceed=1
fi
fi
fi
rm -f tests/integration/docker-slurm/latest_version
echo "proceed=${proceed}" >> $GITHUB_OUTPUT
echo "proceed = ${proceed}"
- name: set-up git
if: steps.check.outputs.proceed == '1'
run: |
git config --global user.email "[email protected]"
git config --global user.name "Neil Munday"
- name: create branch for new Slurm version
if: steps.check.outputs.proceed == '1'
run: |
git checkout -b "slurm_${{ steps.check.outputs.latest_version }}"
- name: update Slurm version in Docker files to latest
if: steps.check.outputs.proceed == '1'
run: |
PYTHONPATH=src tests/integration/docker-slurm/new-version.py
- name: commit changes
if: steps.check.outputs.proceed == '1'
run: |
git commit -a -m "feat: Update SLURM version to ${{ steps.check.outputs.latest_version }}"
git push --set-upstream origin "slurm_${{ steps.check.outputs.latest_version }}"
- name: create pull request
if: steps.check.outputs.proceed == '1'
env:
# need to use a PAT otherwise other workflows will not run
GH_TOKEN: ${{ secrets.PRPAT }}
run: |
gh pr create -a neilmunday -f