Skip to content

Commit

Permalink
add workflow to update overview of available software
Browse files Browse the repository at this point in the history
  • Loading branch information
boegel committed Jun 5, 2024
1 parent 1933d2c commit 9d5e76e
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 6 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/update_available_software.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Update overview of available software in EESSI
on:
- workflow_dispatch
jobs:
update_available_software:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4

- name: set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: x64

- name: Mount EESSI
uses: eessi/[email protected]
with:
eessi_stack_version: '2023.06'

- name: update overview of available software
id: update_available_software
run: |
cd scripts/available_software
# install required Python packages in virtual environment
python -m venv venv
. venv/bin/activate
pip install -r requirements.txt
python available_software.py
git status
# determine whether pull request should be opened:
# if JSON files in docs/available_software/data have been updated, then a PR should be opened
json_data_changed=$((git diff --exit-code ../../docs/available_software/data > /dev/null && echo 'no') || echo 'yes')
if [[ ${json_data_changed} == "yes" ]]; then
echo "JSON files in docs/available_software/data have been changed, PR should be opened"
else
echo "JSON files in docs/available_software/data have not been changed, no need to open PR"
fi
echo "json_data_changed=${json_data_changed}" >> $GITHUB_OUTPUT
- name: create pull request
uses: peter-evans/create-pull-request@v6
if: steps.update_available_software.outputs.json_data_changed == 'yes'
with:
add-paths: docs/available_software
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
7 changes: 1 addition & 6 deletions scripts/available_software/available_software.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import subprocess
import sys
import time
from pathlib import Path
from typing import Union, Tuple
import numpy as np
from mdutils.mdutils import MdUtils
Expand All @@ -35,11 +34,7 @@

def main():
os.environ["SHELL"] = "/bin/bash"
current_dir = Path(__file__).resolve()
project_name = 'docs'
root_dir = next(
p for p in current_dir.parents if p.parts[-1] == project_name
)
root_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
path_data_dir = os.path.join(root_dir, "docs/available_software/data")

# Generate the JSON overviews
Expand Down

0 comments on commit 9d5e76e

Please sign in to comment.