1111env :
1212 JAVA_VERSION : 17
1313 DOCS_REPO : SAP/cloud-sdk
14- PROJECTS : " !:rfc,!:dwc-cf,!:datamodel-metadata-generator,!:odata-generator,!:odata-generator-maven-plugin,!:odata-generator-utility,!:odata-v4-generator,!:odata-v4-generator-maven-plugin,!:s4hana-connectivity,!:soap,!:testutil,!:s4hana-core"
14+ PROJECTS : ' !:rfc,!:dwc-cf,!:datamodel-metadata-generator,!:odata-generator,!:odata-generator-maven-plugin,!:odata-generator-utility,!:odata-v4-generator,!:odata-v4-generator-maven-plugin,!:s4hana-connectivity,!:soap,!:testutil,!:s4hana-core'
1515
1616jobs :
1717 build :
18- name : " JavaDoc to Documentation Portal"
18+ name : ' JavaDoc to Documentation Portal'
1919 runs-on : ubuntu-latest
20+ permissions :
21+ contents : read # all write operations use app token
2022
2123 steps :
22- - name : " Prepare git"
24+ - name : ' Prepare git'
2325 run : |
2426 git config --global user.email "cloudsdk@sap.com"
2527 git config --global user.name "SAP Cloud SDK Bot"
2628
27- - name : " Checkout Repository"
29+ - name : ' Checkout Repository'
2830 uses : actions/checkout@v6
2931 with :
3032 fetch-depth : 0
31-
32- - name : " Switch branch"
33+
34+ - name : ' Switch branch'
3335 run : git checkout "${{ github.event.inputs.branch || 'main' }}"
3436
35- - name : " Set up JDK 17"
37+ - name : ' Set up JDK 17'
3638 uses : actions/setup-java@v5
3739 with :
3840 java-version : ' 17'
3941 distribution : ' temurin'
4042 cache : ' maven'
4143
42- - name : " Determine Versions"
44+ - name : ' Determine Versions'
4345 id : determine-version
4446 run : |
4547 echo "MAJOR_VERSION=$(jq -r '.version' latest.json | cut -d '.' -f 1)" >> $GITHUB_OUTPUT
4648 echo "CURRENT_VERSION=$(jq -r '.version' latest.json)" >> $GITHUB_OUTPUT
4749
48- - name : " Install project (skip tests)"
50+ - name : ' Install project (skip tests)'
4951 run : mvn install -DskipTests --quiet
5052
51- - name : " Process sources"
53+ - name : ' Process sources'
5254 run : mvn process-sources -Drelease --fail-at-end --projects "${PROJECTS}" --quiet
5355
54- - name : " Copy delombok sources"
56+ - name : ' Copy delombok sources'
5557 run : find . -type d -path "*/target/delombok" -exec sh -c 'cp -r "$1"/* "$(dirname $(dirname "$1"))/src/main/java/"' _ {} \;
5658
57- - name : " Generate aggregated Javadoc"
59+ - name : ' Generate aggregated Javadoc'
5860 run : mvn clean javadoc:aggregate -Drelease -Djava.failOnWarning=false --projects "${PROJECTS}" --quiet
5961
60- - name : " Checkout Docs Repository"
62+ - name : ' Create GitHub App Token'
63+ id : app-token
64+ uses : actions/create-github-app-token@v3
65+ with :
66+ client-id : ${{ secrets.SAP_CLOUD_SDK_BOT_CLIENT_ID }}
67+ private-key : ${{ secrets.SAP_CLOUD_SDK_BOT_PRIVATE_KEY }}
68+ owner : SAP
69+ repositories : cloud-sdk
70+ permission-contents : write
71+ permission-pull-requests : write
72+
73+ - name : ' Checkout Docs Repository'
6174 uses : actions/checkout@v6
6275 with :
6376 repository : ${{ env.DOCS_REPO }}
6477 path : .cloud-sdk-docs
65- token : ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
78+ token : ${{ steps.app-token.outputs.token }}
6679
67- - name : " Replace JavaDoc"
80+ - name : ' Replace JavaDoc'
6881 id : replace-javadoc
6982 run : |
7083 TARGET_DIR=./.cloud-sdk-docs/static/java-api/v${{ steps.determine-version.outputs.MAJOR_VERSION }}
95108
96109 git push origin $BRANCH_NAME
97110
98- - name : " Create JavaDoc PR"
111+ - name : ' Create JavaDoc PR'
99112 id : create-javadoc-pr
100113 if : ${{ steps.replace-javadoc.outputs.CREATE_PR == 'true' }}
101114 working-directory : ./.cloud-sdk-docs
@@ -107,4 +120,4 @@ jobs:
107120 echo "PR_URL=$PR_URL" >> $GITHUB_OUTPUT
108121 echo "PR: $PR_URL" >> $GITHUB_STEP_SUMMARY
109122 env :
110- GH_TOKEN : ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
123+ GH_TOKEN : ${{ steps.app-token.outputs.token }}
0 commit comments