-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (42 loc) · 1.68 KB
/
pprcode_biolib_runs_daily.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Generate BioLib Runs Badge
on:
push:
paths:
- '.github/workflows/pprcode_biolib_runs_daily.yml' # Monitor the entire 'docker' directory
schedule:
- cron: "0 0 * * *"
jobs:
generate-badge:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: |
pip3 install pybiolib==1.1.1423
- name: Fetch BioLib Runs count
run: |
echo "BIOLIB_RUNS=$(BIOLIB_TOKEN='${{ secrets.BIOLIB_TOKEN }}' python scripts/biolib_runcount.py)" >> $GITHUB_ENV
echo "BIOLIB_RUNS: ${{ env.BIOLIB_RUNS }}"
- name: Backup old badge
run: mv image/badges/BioLib_Runs_badge.svg image/badges/BioLib_Runs_badge.svg.bak
- name: Fetch new badge
run: |
curl -o image/badges/BioLib_Runs_badge.svg "https://img.shields.io/badge/BioLib_Runs-${{ env.BIOLIB_RUNS }}-55b5a6"
- name: Compare old and new badge to create a git commit
id: compare_badges
run: |
if [[ "$(diff -q image/badges/BioLib_Runs_badge.svg image/badges/BioLib_Runs_badge.svg.bak)" == "" ]]; then
echo "Badges are the same. Skipping the rest of the steps."
else
echo "Badges are differed. Creating a new commit."
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add image/badges/BioLib_Runs_badge.svg
git commit -m "Update BioLib run number to ${{ env.BIOLIB_RUNS }}"
git push
fi