From 46abfdd1eab1277add97b71107a155bf731b293b Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 14 Dec 2023 10:48:57 +0100 Subject: [PATCH 1/9] Add label for deployments --- .github/workflows/deploy-featurebranch.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-featurebranch.yml b/.github/workflows/deploy-featurebranch.yml index c70f2fff20..b572908505 100644 --- a/.github/workflows/deploy-featurebranch.yml +++ b/.github/workflows/deploy-featurebranch.yml @@ -7,7 +7,10 @@ on: jobs: release: - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: | + github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name == 'Budibase/budibase'|| + contains(github.event.issue.labels.*.name, 'feature-branch') runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 5f62004675c292805a513977859c2fcda62aeed9 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 14 Dec 2023 10:52:29 +0100 Subject: [PATCH 2/9] Fix condition --- .github/workflows/deploy-featurebranch.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/deploy-featurebranch.yml b/.github/workflows/deploy-featurebranch.yml index b572908505..9bbab42436 100644 --- a/.github/workflows/deploy-featurebranch.yml +++ b/.github/workflows/deploy-featurebranch.yml @@ -8,8 +8,7 @@ on: jobs: release: if: | - github.event_name != 'pull_request' || - github.event.pull_request.head.repo.full_name == 'Budibase/budibase'|| + (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase') && contains(github.event.issue.labels.*.name, 'feature-branch') runs-on: ubuntu-latest steps: From 934611029fd51a0f0976d33c3921530a6f62b984 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 14 Dec 2023 11:04:28 +0100 Subject: [PATCH 3/9] Add types --- .github/workflows/deploy-featurebranch.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/deploy-featurebranch.yml b/.github/workflows/deploy-featurebranch.yml index 9bbab42436..d177d88a2f 100644 --- a/.github/workflows/deploy-featurebranch.yml +++ b/.github/workflows/deploy-featurebranch.yml @@ -2,6 +2,13 @@ name: deploy-featurebranch on: pull_request: + types: [ + labeled, + # default types + opened, + synchronize, + reopened, + ] branches: - master From 651b42263be270282dee6689a548b109ab369ea4 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 14 Dec 2023 11:05:05 +0100 Subject: [PATCH 4/9] Add comment --- .github/workflows/deploy-featurebranch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-featurebranch.yml b/.github/workflows/deploy-featurebranch.yml index d177d88a2f..b3463b4ccd 100644 --- a/.github/workflows/deploy-featurebranch.yml +++ b/.github/workflows/deploy-featurebranch.yml @@ -4,7 +4,7 @@ on: pull_request: types: [ labeled, - # default types + # default types (https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request) opened, synchronize, reopened, From ad7be462faae3d34308b08eaba932137ddfc773f Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 14 Dec 2023 11:09:04 +0100 Subject: [PATCH 5/9] Fix --- .github/workflows/deploy-featurebranch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-featurebranch.yml b/.github/workflows/deploy-featurebranch.yml index b3463b4ccd..10d57bb6e3 100644 --- a/.github/workflows/deploy-featurebranch.yml +++ b/.github/workflows/deploy-featurebranch.yml @@ -16,7 +16,7 @@ jobs: release: if: | (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase') && - contains(github.event.issue.labels.*.name, 'feature-branch') + contains(github.event.pull_request.labels.*.name, 'feature-branch') runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 4e934a56b7c1bd45822a6bae0fa168439876fec1 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 14 Dec 2023 11:14:05 +0100 Subject: [PATCH 6/9] Delete fb on label removed --- .github/workflows/close-featurebranch.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/close-featurebranch.yml b/.github/workflows/close-featurebranch.yml index 46cb781730..20bf2af5d3 100644 --- a/.github/workflows/close-featurebranch.yml +++ b/.github/workflows/close-featurebranch.yml @@ -2,9 +2,7 @@ name: close-featurebranch on: pull_request: - types: [closed] - branches: - - master + types: [closed, unlabeled] workflow_dispatch: inputs: BRANCH: @@ -14,6 +12,9 @@ on: jobs: release: + if: | + (contains(github.event.pull_request.labels.*.name, 'feature-branch') || + contains(github.event.changes.labels.removed.*.name, 'feature-branch')) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From f1190c47f8aed73fac56c805b18e64a65826d00a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 14 Dec 2023 11:14:26 +0100 Subject: [PATCH 7/9] Do not check base on fb --- .github/workflows/deploy-featurebranch.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/deploy-featurebranch.yml b/.github/workflows/deploy-featurebranch.yml index 10d57bb6e3..a5636fe912 100644 --- a/.github/workflows/deploy-featurebranch.yml +++ b/.github/workflows/deploy-featurebranch.yml @@ -4,13 +4,11 @@ on: pull_request: types: [ labeled, - # default types (https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request) + # default types below (https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request) opened, synchronize, reopened, ] - branches: - - master jobs: release: From c07914a0bf6cdf9ede536da37e58ad60f61a5411 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 14 Dec 2023 11:18:35 +0100 Subject: [PATCH 8/9] Attempt close --- .github/workflows/close-featurebranch.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/close-featurebranch.yml b/.github/workflows/close-featurebranch.yml index 20bf2af5d3..e805cff0e0 100644 --- a/.github/workflows/close-featurebranch.yml +++ b/.github/workflows/close-featurebranch.yml @@ -13,8 +13,8 @@ on: jobs: release: if: | - (contains(github.event.pull_request.labels.*.name, 'feature-branch') || - contains(github.event.changes.labels.removed.*.name, 'feature-branch')) + contains(github.event.pull_request.labels.*.name, 'feature-branch') || + github.event.label.name == 'feature-branch' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 8542b8d87f61fef28172f441360b67887044d5ca Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 14 Dec 2023 11:26:28 +0100 Subject: [PATCH 9/9] Do check labels --- .github/workflows/close-featurebranch.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/close-featurebranch.yml b/.github/workflows/close-featurebranch.yml index e805cff0e0..5da3eb52cd 100644 --- a/.github/workflows/close-featurebranch.yml +++ b/.github/workflows/close-featurebranch.yml @@ -13,8 +13,8 @@ on: jobs: release: if: | - contains(github.event.pull_request.labels.*.name, 'feature-branch') || - github.event.label.name == 'feature-branch' + (github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'feature-branch')) || + github.event.label.name == 'feature-branch' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3