-
Notifications
You must be signed in to change notification settings - Fork 6
80 lines (69 loc) · 2.22 KB
/
version-check.yml
File metadata and controls
80 lines (69 loc) · 2.22 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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@v5
- 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 }}