Skip to content

testing empty variables #68

testing empty variables

testing empty variables #68

Workflow file for this run

name: monthly lcsh check
on:
push:
branches:
- github-actions
# on:
# schedule:
# - cron: '* 9 15 * *'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
ASSIGNEES: charlottekostelic
jobs:
monthly-run:
name: Run monthly LCSH check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Get date var
run: echo "DATE=$(date "+%Y%m%d-%H-%M-%S")" >> $GITHUB_ENV
- name: Create branch, run script
run: |
git checkout -b monthly_check_$DATE
python monthly_lcsh_check.py
echo "CHANGED=$(grep -q 'DEBUG' lcsh.log && echo 'true' || echo 'false')" >> $GITHUB_ENV
echo "REVISED=$(grep -q 'DEBUG - Revised' lcsh.log && echo 'true' || echo 'false')" >> $GITHUB_ENV
echo "DEPRECATED=$(grep -q 'DEBUG - Deprecated' lcsh.log && echo 'true' || echo 'false')" >> $GITHUB_ENV
- name: Create PR text (no changes)
run: |

Check failure on line 42 in .github/workflows/monthly-check.yaml

View workflow run for this annotation

GitHub Actions / monthly lcsh check

Invalid workflow file

The workflow is not valid. .github/workflows/monthly-check.yaml (Line: 42, Col: 14): Unexpected symbol: '['. Located at position 1 within expression: [-z env.REVISED] == 'false' && '### Added:' && ' + New infile is: data/acc_in.csv' && ' + Old infile is: data/acc_in_$DATE' || ''
{
echo "PR_BODY<<EOF"
echo "### Changed:"
echo " + lcsh.log updated with data from workflow run on $(date '+%D')"
echo "${{ [-z env.REVISED] == 'false' && '### Added:' && ' + New infile is: data/acc_in.csv' && ' + Old infile is: data/acc_in_$DATE' || '' }}"
echo EOF
} >> $GITHUB_ENV
- name: Create PR and Issue text (changes)
if: ${{ env.CHANGED == 'true' }}
run: |
{
echo "ISSUE_BODY<<EOF"
echo "${{ env.REVISED == 'true' && '### Changed:' && '$(grep "DEBUG - Revised" lcsh.log | grep -Eo "\[.+]$")' || '$(grep -q "DEBUG - Revised" lcsh.log)' }}"
echo "${{ env.DEPRECATED == 'deprecated' && '### Deprecated:' && '$(grep "DEBUG - Deprecated" lcsh.log | grep -Eo "\[.+]$")' || '$(grep -q "DEBUG - Deprecated" lcsh.log)'}}"
echo EOF
} >> $GITHUB_ENV
- name: Check PR and Issue text
run: |
echo "CHANGED: ${{ env.CHANGED }}"
echo "PR_BODY: ${{ env.PR_BODY }}"
echo "ISSUE_BODY: ${{ env.ISSUE_BODY }}"