Skip to content

Bump actions/checkout from 4.2.0 to 4.2.1 #296

Bump actions/checkout from 4.2.0 to 4.2.1

Bump actions/checkout from 4.2.0 to 4.2.1 #296

Workflow file for this run

name: Test utility scripts
on:
pull_request:
branches:
- main
types:
# We want this workflow triggered if the 'infrastructure' label is added
# or present when PR is updated
- opened
- reopened
- synchronize
- labeled
jobs:
notebooks:
# get_modified_tutorials.py
name: "Test get_modified_tutorials.py script"
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'infrastructure')
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: 3.9
- name: Install dependencies and setup
run: |
sudo apt-get install pandoc
python -m pip install -U pip
python -m pip install gitpython
git config --global user.email "bot@robot.com"
git config --global user.name "Botty McBotface"
# Make sure if a file is removed, it does not appear in the modified list:
- name: Test 1a - removed (staged)
run: |
git rm tutorials/FITS-header/FITS-header.ipynb
MODIFIED=$(python .github/get_modified_tutorials.py --main-branch origin/main)
[ ! -z "$MODIFIED" ] && exit 1 || echo "Success!"
git reset --hard HEAD
- name: Test 1b - removed and committed
run: |
git rm tutorials/FITS-header/FITS-header.ipynb
git commit -m "TEST COMMIT"
MODIFIED=$(python .github/get_modified_tutorials.py --main-branch origin/main)
[ ! -z "$MODIFIED" ] && exit 1 || echo "Success!"
git reset --hard HEAD~1
# Make sure if a file is modified, it appears in the modified list:
- name: Test 2a - edited
run: |
echo "TEST" >> tutorials/FITS-header/FITS-header.ipynb
MODIFIED=$(python .github/get_modified_tutorials.py --main-branch origin/main)
[ "$MODIFIED" != "tutorials/FITS-header/FITS-header.ipynb" ] && exit 1 || echo "Success!"
git reset --hard HEAD
- name: Test 2b - edited and staged
run: |
echo "TEST" >> tutorials/FITS-header/FITS-header.ipynb
git add tutorials/FITS-header/FITS-header.ipynb
MODIFIED=$(python .github/get_modified_tutorials.py --main-branch origin/main)
[ "$MODIFIED" != "tutorials/FITS-header/FITS-header.ipynb" ] && exit 1 || echo "Success!"
git reset --hard HEAD
- name: Test 2c - edited and committed
run: |
echo "TEST" >> tutorials/FITS-header/FITS-header.ipynb
git add tutorials/FITS-header/FITS-header.ipynb
git commit -m "TEST COMMIT"
MODIFIED=$(python .github/get_modified_tutorials.py --main-branch origin/main)
[ "$MODIFIED" != "tutorials/FITS-header/FITS-header.ipynb" ] && exit 1 || echo "Success!"
git reset --hard HEAD~1
# Make sure if a file is created, it appears in the modified list:
- name: Test 3a - created and staged
run: |
touch tutorials/FITS-header/FITS-header2.ipynb
git add tutorials/FITS-header/FITS-header2.ipynb
MODIFIED=$(python .github/get_modified_tutorials.py --main-branch origin/main)
[ "$MODIFIED" != "tutorials/FITS-header/FITS-header2.ipynb" ] && exit 1 || echo "Success!"
git reset --hard HEAD
- name: Test 3b - created and committed
run: |
touch tutorials/FITS-header/FITS-header2.ipynb
git add tutorials/FITS-header/FITS-header2.ipynb
git commit -m "TEST COMMIT"
MODIFIED=$(python .github/get_modified_tutorials.py --main-branch origin/main)
[ "$MODIFIED" != "tutorials/FITS-header/FITS-header2.ipynb" ] && exit 1 || echo "Success!"
git reset --hard HEAD~1