Check for logo updates #3076
This file contains hidden or 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: Check for logo updates | |
| on: | |
| schedule: | |
| - cron: '0 7,11,15,19 * * *' | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| check-dropbox: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout control branch | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| - name: Create control branch | |
| run: | | |
| git checkout -b control-branch | |
| - name: Setup Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Set Env | |
| run: | | |
| touch .env | |
| echo APP_KEY=${{ secrets.APP_KEY }} >> .env | |
| echo APP_SECRET=${{ secrets.APP_SECRET }} >> .env | |
| echo DROPBOX=${{ secrets.DROPBOX }} >> .env | |
| - name: Install Packages | |
| run: pnpm install | |
| - name: Version Check | |
| run: pnpm run version-check | |
| - name: Commit changes if any | |
| id: commit | |
| run: | | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| git add . | |
| git commit -m "Fetch updated logos from Dropbox" --no-verify --signoff | |
| git push -f origin control-branch | |
| echo "changes_detected=true" >> $GITHUB_ENV | |
| else | |
| echo "No changes to commit." | |
| echo "changes_detected=false" >> $GITHUB_ENV | |
| fi | |
| - name: Check if PR exists | |
| id: check | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| prs=$(gh pr list \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --head 'control-branch' \ | |
| --base 'main' \ | |
| --json title \ | |
| --jq 'length') | |
| if ((prs > 0)); then | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "skip=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Create pull request | |
| if: env.changes_detected == 'true' && steps.check.outputs.skip != 'true' | |
| run: gh pr create -B main -H control-branch --title 'Check logo updates' --reviewer 'hiletmis' --body-file .changeset/changeset.md | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |