Merge pull request #1392 from KLayout/thomaslima-patch-1

Update build.yml - enable builds on main branch
This commit is contained in:
Matthias Köfferlein 2023-06-02 00:18:49 +02:00 committed by GitHub
commit ff2515b6b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 2 deletions

View File

@ -4,8 +4,11 @@ name: Build Python Wheels
on:
pull_request:
# Running on PRs is enough
# push:
# Running on PRs and main branch only
# pull requests should be able to access cache from main branch
push:
branches:
- master
release:
types: [published]

35
.github/workflows/cache-maintenance.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: cleanup caches by a branch
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries
# Caches are very large and must be deleted to prioritize main branch's caches.
on:
pull_request:
types:
- closed
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}