Update Package Cache #6325
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
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 |