Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add merge_group support to builds workflow #429

Merged
merged 1 commit into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Builds
name: 🖥️ Builds

on:
push:
Expand All @@ -15,6 +15,13 @@ on:
- 'LICENSE-EXCEPTIONS.md'
- 'LICENSE.md'
- 'README.md'
merge_group:
paths-ignore:
- '.vscode/**'
- 'docs/**'
- 'LICENSE-EXCEPTIONS.md'
- 'LICENSE.md'
- 'README.md'

env:
GODOT_BASE_DOWNLOAD_URL: https://github.com/godotengine/godot
Expand Down Expand Up @@ -45,9 +52,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
git config diff.wsErrorHighlight all
if [ "${{ github.event_name }}" == "pull_request" -o "${{ github.event.forced }}" == "true" -o "${{ github.event.created }}" == "true" ]; then
files=$(git diff-tree --no-commit-id --name-only -r HEAD^1..HEAD 2> /dev/null || true)
elif [ "${{ github.event_name }}" == "push" -a "${{ github.event.forced }}" == "false" -a "${{ github.event.created }}" == "false" ]; then
elif [ "${{ github.event_name }}" == "push" -a "${{ github.event.created }}" == "false" ]; then
files=$(git diff-tree --no-commit-id --name-only -r ${{ github.event.before }}..${{ github.event.after }} 2> /dev/null || true)
fi
echo "$files" >> changed.txt
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/cache_cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#force-deletion-of-caches-overriding-default-cache-eviction-policy
name: 🧹 Cache Cleanup
on:
pull_request:
types:
- closed

jobs:
cleanup:
name: Cleanup PR caches
runs-on: ubuntu-latest
permissions:
# `actions:write` permission is required to delete caches
actions: write
contents: read
steps:
- name: Cleanup
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
run: |
echo "Fetching list of cache key"
cache_keys_for_pr=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id')
# Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cache_key in $cache_keys_for_pr; do
gh cache delete $cache_key
echo "Deleted: $cache_key"
done
echo "Done"