diff --git a/.github/labeler.yml b/.github/labeler.yml index 692b0867ded..85eca8ecafb 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,6 +1,3 @@ -core: - - core/**/* - ci: - ci/**/* - .github/**/* @@ -10,3 +7,6 @@ dashboard: consent: - apps/consent/* + +core: + - core/**/* diff --git a/.github/workflows/buck2-build.yaml b/.github/workflows/buck2-build.yaml index 02ffc041958..e4db8ee1e4b 100644 --- a/.github/workflows/buck2-build.yaml +++ b/.github/workflows/buck2-build.yaml @@ -1,8 +1,8 @@ -name: "Buck2 build" - +name: Buck2 build on: pull_request: branches: [main] + types: [opened, synchronize, labeled, unlabeled] jobs: buck2-build: @@ -13,5 +13,24 @@ jobs: - uses: cachix/install-nix-action@v22 with: github_access_token: ${{ secrets.GITHUB_TOKEN }} + - name: Prepare Buck2 build args from labels + id: prepare_args + run: | + ARGS="" + cat < labels.json + ${{ toJSON(github.event.pull_request.labels.*.name) }} + EOF + for LABEL in $(cat labels.json | jq -r '.[]') do + case "$LABEL" in + dashboard|consent) + ARGS+=" //apps/$LABEL" + ;; + core) + ARGS+=" //core/api" + ;; + esac + done + echo "Prepared args: $ARGS" + echo "args=$ARGS" >> "$GITHUB_OUTPUT" - name: Buck2 build - run: nix develop -c buck2 build //core/api:api + run: nix develop -c buck2 build ${{ steps.prepare_args.outputs.args }}