Update Outdated Packages Badge #211
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 Outdated Packages Badge | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 0 * * *' # Runs daily at midnight | |
workflow_dispatch: | |
jobs: | |
update-badge: | |
runs-on: ubuntu-latest | |
container: | |
image: bredos/bredos:latest | |
ports: | |
- 80 | |
options: --privileged | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install dependencies | |
run: | | |
init-docker | |
pacman -Sy --noconfirm --needed pyalpm github-cli | |
- name: Update Gist | |
env: | |
GH_TOKEN: ${{ secrets.GIST_TOKEN }} | |
GIST_ID: 'b5759b3d8a067b7e96f73934f43bf2ce' | |
run: | | |
OUTDATED=$(python -c "import compare; print(len(compare.lists()))") | |
echo "Outdated packages: $OUTDATED" | |
if [ "$OUTDATED" -gt 0 ]; then | |
COLOR="red" | |
else | |
COLOR="green" | |
fi | |
gh api --method PATCH -H "Accept: application/vnd.github+json" \ | |
/gists/$GIST_ID \ | |
-f files[outdated-packages-multilib.json][content]="{ | |
\"schemaVersion\": 1, | |
\"label\": \"Outdated Packages\", | |
\"message\": \"$OUTDATED\", | |
\"color\": \"$COLOR\" | |
}" |