testing empty variables #68
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: 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 GitHub Actions / monthly lcsh checkInvalid workflow file
|
||
{ | ||
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 }}" |