From 6543ee126d1a8e3fb30381b84d90e6d04e60c425 Mon Sep 17 00:00:00 2001
From: GianlucaOberreit <109722947+GianlucaOberreit@users.noreply.github.com>
Date: Tue, 8 Aug 2023 18:03:13 +0200
Subject: [PATCH] Update committee_creation.yml

Update action to checkout new branch and push changes
---
 .github/workflows/committee_creation.yml | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/committee_creation.yml b/.github/workflows/committee_creation.yml
index c055e3f..16cddbd 100644
--- a/.github/workflows/committee_creation.yml
+++ b/.github/workflows/committee_creation.yml
@@ -10,7 +10,7 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - name: Check out code
-        uses: actions/checkout@v2
+        uses: actions/checkout@v3
 
       - name: Generate Committee File
         run: |
@@ -19,6 +19,13 @@ jobs:
           sed "s/class example/class $branch_name/g" src/Committees/example.py > "src/Committees/${branch_name}.py"
         shell: bash
 
+      - name: Switch to New Branch
+        run: |
+          branch_name=${{ github.ref }}
+          git fetch origin $branch_name:$branch_name
+          git checkout $branch_name
+        shell: bash
+
       - name: Create Committee Team
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -29,3 +36,14 @@ jobs:
             -H "Authorization: Bearer $GITHUB_TOKEN" \
             -d '{"name":"'$branch_name'","privacy":"closed"}' \
             https://api.github.com/orgs/YOUR_ORG/teams
+
+      - name: Create Team
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        run: |
+          branch_name=${{ github.ref }}
+          branch_name=${branch_name#refs/heads/comm/}
+          curl -X POST \
+            -H "Authorization: Bearer $GITHUB_TOKEN" \
+            -d '{"name":"'$branch_name'","privacy":"closed"}' \
+            https://api.github.com/orgs/YOUR_ORG/teams
-- 
GitLab