update-analysis #137
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: update-analysis | |
on: | |
workflow_dispatch: | |
schedule: | |
# Weekly on Wednesday (software updated Sunday night) | |
- cron: 0 0 * * 3 | |
jobs: | |
UpdateAnalysis: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Install Research Software Encyclopedia | |
run: | | |
sudo apt-get update && sudo apt-get install -y python3 python3-pip python3-setuptools | |
#sudo pip3 install rse[all] | |
git clone https://github.com/rseng/rse /tmp/rse | |
cd /tmp/rse | |
sudo pip3 install .[all] | |
cd - | |
pip install -r requirements.txt | |
python -m nltk.downloader popular | |
rse --version | |
- name: Make Space | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /usr/local/lib/android | |
sudo rm -rf /opt/ghc | |
- name: Load CiteLang Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.citelang | |
key: ${{ runner.os }}-citelang-cache | |
restore-keys: | | |
${{ runner.os }}-citelang-cache | |
${{ runner.os }} | |
- name: Populate CiteLang Cache | |
run: | | |
if [[ ! -d "$HOME/.citelang" ]]; then | |
git clone https://github.com/researchapps/citelang-cache $HOME/.citelang | |
fi | |
tree ~/.citelang | |
- name: Download Latest Software Database | |
env: | |
RSE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git clone https://github.com/rseng/software /tmp/software | |
python 1.download.py --settings-file /tmp/software/rse.ini -o ./_repos | |
python 2.analysis.py --settings-file /tmp/software/rse.ini -o ./_repos | |
find _repos -type d -empty -print -delete | |
- name: Save Updated Cache | |
uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os }}-citelang-cache | |
path: | | |
~/.citelang | |
- name: Checkout New Branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH_AGAINST: "main" | |
run: | | |
printf "GitHub Actor: ${GITHUB_ACTOR}\n" | |
export BRANCH_FROM="update/analysis-$(date '+%Y-%m-%d')" | |
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | |
git branch | |
git checkout -b "${BRANCH_FROM}" || git checkout "${BRANCH_FROM}" | |
git branch | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
git add _repos/* | |
git add docs/* | |
git add pages/* | |
git add _data/* | |
if git diff-index --quiet HEAD --; then | |
printf "No changes\n" | |
else | |
printf "Changes\n" | |
git commit -m "Automated deployment to update software database $(date '+%Y-%m-%d')" | |
git push origin "${BRANCH_FROM}" | |
fi | |
echo "PULL_REQUEST_FROM_BRANCH=${BRANCH_FROM}" >> $GITHUB_ENV | |
- name: Open Pull Request | |
uses: vsoch/pull-request-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PULL_REQUEST_BRANCH: "main" |