diff --git a/.github/workflows/committee_creation.yml b/.github/workflows/committee_creation.yml new file mode 100644 index 0000000000000000000000000000000000000000..c055e3fb3357742b838843f4ed959685bd908ec3 --- /dev/null +++ b/.github/workflows/committee_creation.yml @@ -0,0 +1,31 @@ +name: Create Branch File + +on: + create: + branches: + - 'committee/*' + +jobs: + create-file: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Generate Committee File + run: | + branch_name=${{ github.ref }} + branch_name=${branch_name#refs/heads/committee/} + sed "s/class example/class $branch_name/g" src/Committees/example.py > "src/Committees/${branch_name}.py" + shell: bash + + - name: Create Committee Team + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + branch_name=${{ github.ref }} + branch_name=${branch_name#refs/heads/committee/} + curl -X POST \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -d '{"name":"'$branch_name'","privacy":"closed"}' \ + https://api.github.com/orgs/YOUR_ORG/teams