Hey all, Example taken from: <https://docs.lakefs...
# help
g
Hey all, Example taken from: https://docs.lakefs.io/setup/hooks.html How can I address all available branches (instead of just "main")?
Copy code
name: Good files check
description: set of checks to verify that branch is good
on:
  pre-commit:
  pre-merge:
    branches:
      - main
hooks:
  - id: no_temp
    type: webhook
    description: checking no temporary files found
    properties:
      url: "<https://your.domain.io/webhook?notmp=true?t=1za2PbkZK1bd4prMuTDr6BeEQwWYcX2R>"
  - id: no_freeze
    type: webhook
    description: check production is not in dev freeze
    properties:
      url: "<https://your.domain.io/webhook?nofreeze=true?t=1za2PbkZK1bd4prMuTDr6BeEQwWYcX2R>"
n
Hi @Gal Bachar, In the example you provided you can see 2 'on' targets: 1. pre-commit without any branch - which means it will trigger on all branches 2. pre-merge with branches field = main which will trigger only on branch main
🙌 1
👍 1
i
Hi @Gal Bachar and thank you for this question You can address all branches by leaving the
branches:
entry empty Note that this will not work for
Tag
events
😀 1
g
@Niro @Itai David I believe I've tried the empty "branches:" approach, but let me make another attempt. I'll update here 🙂
n
@Gal Bachar
Copy code
// if no branches spec found - all match
	if actionOn == nil || len(actionOn.Branches) == 0 {
		return true, nil
	}
Providing no branch names under 'branches' or not providing 'branches' at all should do the trick . Please note: that this is the case only for lakeFS versions 0.62.0 and above. Let us know if it works out for you
g
@Niro empty branches worked, thanks
n
Great! Thanks for the update