WIP: Refinement tree #145
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
# Move molfiles, metadata, and drawings at root to a subfolder named after the molecule. | |
name: format_dataset | |
on: | |
push: | |
paths: | |
- 'tests/molfiles/**' | |
workflow_dispatch: | |
jobs: | |
molecule_subdirectories: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
- name: move files | |
run: | | |
shopt -s extglob # enables use of patterns when stripping `moldata` to obtain `molname` | |
shopt -s nullglob # don't execute loop in case there's no matching `moldata` | |
cd tests/molfiles | |
for moldata in ./*.mol ./*_metadata.txt ./*_drawing.*; do | |
molname=${moldata%@(.mol|_metadata.txt|_drawing.*)} | |
if [ ! -d "$molname" ]; then | |
echo "Making ${molname} directory." | |
mkdir "${molname}" | |
fi | |
mv "$moldata" "${molname}" | |
done | |
- name: push changes | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
git add . | |
if ! git diff-index --quiet HEAD; then | |
git commit -m "Auto-formatted test dataset." | |
git push | |
fi |