gradle/gradle-build-action

Docs and Support for merge queues

yogurtearl opened this issue · 1 comments

Info about Merge Queues:
https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue#about-merge-queues

If we build on the merge_group: trigger for the main queue, the cache is read-only.
It would be nice if we could cache from the merge_group trigger and avoid having to also build on push trigger on main.

Would need a config like this:

      # https://github.com/gradle/gradle-build-action/releases/tag/v2.8.0
      - uses: gradle/gradle-build-action@ef76a971e2fa3f867b617efd72f2fbd72cf6f8bc
        with:
          gradle-home-cache-cleanup: true
          cache-read-only: >
            ${{ !(github.event_name == 'push' && github.ref == 'refs/heads/main')
              && !(github.event_name == 'merge_group' && github.event.merge_group.base_ref == 'refs/heads/main') }}

But even with that fix, not sure we can restore the cache on pull requests, until this is addressed:
https://github.com/orgs/community/discussions/66430

Until that is addressed, might want to add something saying you shouldn't write to cache from the merge_group trigger.

bigdaz commented

Thanks for pointing out that this is an issue. I've updated the documentation to explain that enabling caching for merge_group is generally not helpful.

Unfortunately, any merge_group triggered job will execute against a temporary branch, and there's not really anything this action can do to make written cache entries available to other branch executions.