Skip to content

Commit

Permalink
asset check
Browse files Browse the repository at this point in the history
  • Loading branch information
geritwagner committed Jan 27, 2025
1 parent bb262ed commit 473999d
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/.asset_ignore.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
assets/images/logo-3.png
assets/images/logo-2.png
assets/images/logo-4.png
assets/images/theses.png
69 changes: 69 additions & 0 deletions .github/workflows/assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Asset checker

on:
repository_dispatch:
workflow_dispatch:
push:
branches:
- main
pull_request:
types: [closed]
schedule:
- cron: '10 2 * * 3'

jobs:
assetChecker:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Set up GitHub CLI
run: |
sudo apt-get install -y gh
- name: Identify dangling assets
run: |
python .github/workflows/check-assets.py
continue-on-error: false

- name: Check for dangling_assets file
id: dangling_assets
run: |
if [ -f ./dangling_assets.md ]; then
echo "Dangling assets file found"
echo "found=true" >> $GITHUB_ENV
else
echo "Dangling assets file not found"
echo "found=false" >> $GITHUB_ENV
fi
continue-on-error: false

- name: Search for existing "Assets report" issue
id: find_issue
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Set the token
run: |
gh issue list --state open --search "Assets report" --json number --jq '.[0].number' > issue_number.txt || echo "" > issue_number.txt
issue_number=$(cat issue_number.txt)
echo "Issue number: $issue_number"
echo "issue_number=$issue_number" >> $GITHUB_ENV
- name: Create new issue if not found
if: env.issue_number == ''
uses: peter-evans/create-issue-from-file@v5
with:
title: Assets report
content-filepath: ./dangling_assets.md
labels: report, automated issue

- name: Update existing issue
if: env.issue_number != ''
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Set the token
run: |
if [ -f ./dangling_assets.md ]; then
gh issue edit ${{ env.issue_number }} --body-file ./dangling_assets.md
else
echo "No dangling assets file to update issue."
fi

0 comments on commit 473999d

Please sign in to comment.