-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (55 loc) · 1.81 KB
/
update-cache.yml
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
name: Update Package Cache
on:
push:
branches:
- master
paths-ignore:
- 'docs/**'
schedule:
- cron: '0 0/6 * * *'
repository_dispatch:
types: rebuild-cache
workflow_dispatch:
jobs:
update-cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Update package cache
run: |
mv cache.json cache-old.json
npm --no-save --no-package-json install @qooxdoo/compiler
npx qx config set github.token "${{ secrets.PAT }}"
npx qx package update --verbose --search --all-versions --file cache.json
if git diff --quiet --exit-code; then
echo "No changes"
else
echo "Changes found"
NUM_REPOS_OLD=$(jq -r ".repos.list | length" cache-old.json)
NUM_REPOS_NEW=$(jq -r ".repos.list | length" cache.json)
if [[ $NUM_REPOS_NEW > $NUM_REPOS_OLD ]]; then
echo "CREATE_PR=1" >> $GITHUB_ENV
echo "At least one new repository detected, creating PR"
else
echo "COMMIT_UPDATE=1" >> $GITHUB_ENV
echo "Committing changes"
fi
fi
rm cache-old.json
- name: Commit updated cache
if: ${{ env.COMMIT_UPDATE }}
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Commit cache update
- name: Create Pull Request
if: ${{ env.CREATE_PR }}
uses: peter-evans/create-pull-request@v3
with:
commit-message: Update package cache
token: ${{ secrets.PAT }}
title: Automated Cache Updates
body: This is an auto-generated PR with updates to the package cache
branch: update-cache