Check logo updates #46
Workflow file for this run
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
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@v4 | |
with: | |
ref: main | |
fetch-depth: 0 | |
- name: Create control branch | |
run: | | |
git checkout -b control-branch | |
- 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: Diff Check | |
id: diff-check | |
run: | | |
git diff main control-branch --name-only | |
if [[ $(git diff main control-branch --name-only) ]]; then | |
echo "changes_detected=true" >> "$GITHUB_ENV" | |
fi | |
- name: Commit changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
if : steps.diff-check.outputs.changes_detected == 'true' | |
id: auto-commit-action | |
with: | |
branch: control-branch | |
commit_message: Fetch updated logos from Dropbox | |
commit_options: '--no-verify --signoff' | |
push_options: '--force' | |
- 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" | |
fi | |
- name: Create pull request | |
if: steps.auto-commit-action.outputs.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 }} |