forked from bitnami/charts
-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (40 loc) · 1.54 KB
/
sync-teams.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Copyright VMware, Inc.
# SPDX-License-Identifier: APACHE-2.0
name: '[Support] Synchronize team members in the .env file'
on:
schedule:
# Daily
- cron: '0 5 * * *'
# Remove all permissions by default. Write actions are done by Bitnami Bot
permissions: {}
jobs:
sync-support-teams:
runs-on: ubuntu-latest
steps:
- name: Repo checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.BITNAMI_BOT_TOKEN }}
fetch-depth: 1
- name: Load .env file
uses: xom9ikk/dotenv@v2
with:
path: .github/workflows/
- name: Updating members of the Bitnami team
run: |
TEAM_MEMBERS=$(curl --request GET \
--url https://api.github.com/orgs/bitnami/teams/developers/members?per_page=100 \
--header 'authorization: Bearer ${{ secrets.BITNAMI_BOT_TOKEN }}' \
--header 'content-type: application/json' \
| jq 'sort_by(.login)|map(.login)|join(",")')
TEAM_MEMBERS='['${TEAM_MEMBERS//','/'","'}']'
if [ $TEAM_MEMBERS != $BITNAMI_TEAM ]; then
echo "Replacing $BITNAMI_TEAM for $TEAM_MEMBERS"
sed -i "s|BITNAMI_TEAM=.*$|BITNAMI_TEAM='${TEAM_MEMBERS}'|g" .github/workflows/.env
git config user.name "bitnami-bot"
git config user.email "[email protected]"
git commit -s -m"[bitnami-bot] Updating Bitnami team members" .github/workflows/.env
git push
else
echo "BITNAMI_TEAM is updated and nothing should be done"
fi