Update overview of available software in EESSI #1667
This file contains hidden or 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: Update overview of available software in EESSI | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # run twice a day (noon + midnight) | |
| - cron: '0 */12 * * *' | |
| jobs: | |
| update_available_software: | |
| if: github.repository_owner == 'EESSI' # Prevent running on forks | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
| - name: set up Python | |
| uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | |
| with: | |
| python-version: '3.10' | |
| architecture: x64 | |
| - name: update overview of available software | |
| id: update_available_software | |
| run: | | |
| # install required Python packages in virtual environment | |
| python -m venv venv | |
| . venv/bin/activate | |
| pip install -r scripts/available_software/requirements.txt | |
| # download https://eessi.io/api_data/data/eessi_api_metadata_software.json | |
| # to where it's expected by docs/available_software/macros.py and scripts/available_software/available_software.py | |
| data_dir="docs/available_software/data" | |
| mkdir -p ${data_dir} | |
| cd ${data_dir} | |
| curl -OL https://eessi.io/api_data/data/eessi_api_metadata_software.json | |
| cd - | |
| python scripts/available_software/available_software.py | |
| ./scripts/update_generated_time.sh mkdocs.yml | |
| git status | |
| # determine whether pull request should be opened: | |
| # if detailed software pages in docs/available_software/detail have been updated, then a PR should be opened | |
| if [[ $(git status --porcelain ./docs/available_software/detail) ]]; then | |
| echo "Software pages have been changed, PR should be opened" | |
| echo "json_data_changed=yes" >> $GITHUB_OUTPUT | |
| else | |
| echo "Software pages have not been changed, no need to open PR" | |
| echo "json_data_changed=no" >> $GITHUB_OUTPUT | |
| fi | |
| # remove the JSON file in the data directory, or it'll end up in the PR being opened | |
| rm -r ${data_dir}/*.json | |
| - name: create pull request | |
| uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 | |
| if: steps.update_available_software.outputs.json_data_changed == 'yes' | |
| with: | |
| add-paths: | | |
| docs/available_software | |
| mkdocs.yml | |
| branch: update-software-overview | |
| branch-suffix: timestamp | |
| commit-message: update overview of available software | |
| title: update overview of available software | |
| body: '' | |
| token: ${{ secrets.EESSIBOT_GITHUB_TOKEN }} | |
| push-to-fork: EESSIbot/docs |