11name : Helm update
22
3-
43on :
54 workflow_call :
65 workflow_dispatch :
98 verify-helm-changes :
109 name : Verify if AKO helm charts needs updates
1110 runs-on : ubuntu-latest
11+ environment : release
12+ permissions :
13+ contents : write
14+ pull-requests : write
1215 steps :
1316 - name : Checkout AKO repo
1417 uses : actions/checkout@v4
@@ -18,15 +21,24 @@ jobs:
1821 with :
1922 enable-cache : ' true'
2023
21- - name : Configure git
22- run : |
23- git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
24- git config --global user.name "github-actions[bot]"
24+ - name : Generate GitHub App Token
25+ id : generate_token
26+ uses : actions/create-github-app-token@v1
27+ with :
28+ app-id : ${{ secrets.AKO_RELEASER_APP_ID }}
29+ private-key : ${{ secrets.AKO_RELEASER_RSA_KEY }}
30+ owner : ${{ github.repository_owner }}
31+ repositories : |
32+ mongodb-atlas-kubernetes
33+ helm-charts
2534
26- - name : Checkout Helm Repo
27- run : |
28- git clone https://github.com/mongodb/helm-charts.git ./helm-charts-cloned
29- ls -lah
35+ - name : Checkout Helm charts repo
36+ uses : actions/checkout@v4
37+ with :
38+ repository : mongodb/helm-charts
39+ token : ${{ steps.generate_token.outputs.token }}
40+ path : helm-charts-cloned
41+ persist-credentials : true
3042
3143 - name : Verify if CRDs were changed
3244 id : crd-check
@@ -44,17 +56,29 @@ jobs:
4456
4557 - name : Create PR for helm-charts repo
4658 env :
47- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
59+ GH_TOKEN : ${{ steps.generate_token.outputs.token }}
4860 run : |
4961 cd ./helm-charts-cloned
5062
5163 if [[ -n $(git status --porcelain) ]]; then
52- BRANCH_NAME=CRD-RBAC-changes-${{ github.run_id }}
53- COMMIT_MSG="[autogenerated] update CRDs and RBAC ${{ github.run_id }}"
64+ jobname=${{ github.run_id }}
65+ if [[ -n "${{ github.event.pull_request.title }}" ]]; then
66+ jobname="${{ github.event.pull_request.title }}"
67+ fi
68+
69+ BRANCH_NAME=CRD-RBAC-changes-"${jobname}"
70+ COMMIT_MSG="[autogenerated] update CRDs and RBAC ${jobname}"
5471 echo "Changes detected. Creating PR"
72+
73+ git config --local user.email "akobot@ako-team-fake.mongodb.com"
74+ git config --local user.name "ako-releaser"
75+
5576 git checkout -b "${BRANCH_NAME}"
5677 git add .
5778 git commit -m "${COMMIT_MSG}"
58- gh pr create -B main -H "${BRANCH_NAME}" --title "${COMMIT_MSG}" --body "${COMMIT_MSG}"
79+
80+ git push origin "${BRANCH_NAME}"
81+
82+ gh pr create --base main --head "${BRANCH_NAME}" --title "${COMMIT_MSG}" --body "${COMMIT_MSG}"
5983 fi
6084 echo "Nothing to commit"
0 commit comments