Skip to content

github-action update #11

github-action update

github-action update #11

# workflow to update the keyword usage of the theses projects
name: Check for updates the keywords used in the project descriptions
on:
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write
# The following permissions are needed by the pages call if a change occured.
pages: write
id-token: write
jobs:
changed_files:
runs-on: ubuntu-latest # windows-latest || macos-latest
name: Test changed-files
outputs:
project_changes: ${{ env.PROJECT_CHANGES }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
- name: Get changed files in the _theses_dir_folder folder
id: changed-files-specific

Check failure on line 30 in .github/workflows/update_keyword_data.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/update_keyword_data.yaml

Invalid workflow file

You have an error in your yaml syntax on line 30
uses: tj-actions/changed-files@v42
with:
files: _theses_dir/** # Alternatively using: `docs/**`
- name: Run step if any file(s) in the docs folder change
env:
ALL_CHANGED_FILES: ${{ steps.changed-files-specific.outputs.all_changed_files }}
run: |
echo "One or more files in the _theses_dir folder has changed."
echo "List all the files that have changed: $ALL_CHANGED_FILES"
echo "PROJECT_CHANGES=$(env.ALL_CHANGED_FILES | wc -l)" >> $GITHUB_ENV
update_wordlist:
needs: [changed_files]
if: needs.changed-files.outputs.project_changes != '0'
runs-on: ubuntu-latest
outputs:
keyword_changes: ${{ env.KEYWORD_CHANGES }}
steps:
- name: clone
uses: actions/checkout@v1
- name: setup python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: run keyword counting script
id: count_and_sort
run: |
pip install python-frontmatter==1.1.0 PyYAML==6.0
python assets/python/update_keywords.py
echo "KEYWORD_CHANGES=$(git diff --name-only | wc -l)" >> $GITHUB_ENV
- name: print_env
run: |
env
- name: push_if_updated
if: env.KEYWORD_CHANGES != '0'
run: |
git add _data/keywords.yaml
git config --local user.email "keyword_change@github.org"
git config --local user.name "GitHub Action"
git commit -m "Updated keyword list"
- name: Push changes
if: env.KEYWORD_CHANGES != '0'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
update_pages:
needs: [update_wordlist]
if: needs.update_wordlist.outputs.keyword_changes != '0'
uses: ./.github/workflows/jekyll.yml