Skip to content

Commit 276930a

Browse files
chore: Use GH app instead of token (#6463)
--------- Co-authored-by: David Knaack <[email protected]>
1 parent e91a006 commit 276930a

5 files changed

Lines changed: 54 additions & 30 deletions

File tree

.github/workflows/api-docs.yml

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,50 +19,48 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- uses: actions/checkout@v6
22-
22+
2323
- run: git fetch --depth=1
24-
24+
2525
- uses: actions/setup-node@v6
2626
with:
2727
node-version: 22
2828
cache: 'yarn'
29-
29+
3030
- run: yarn install --frozen-lockfile --ignore-engines
31-
31+
3232
- name: Generate API documentation
3333
run: |
3434
yarn generate
3535
yarn doc
36-
37-
- name: Setup SSH key for cloud-sdk repo
38-
env:
39-
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
40-
run: |
41-
mkdir -p ~/.ssh
42-
ssh-keyscan github.com >> ~/.ssh/known_hosts
43-
echo "${{ secrets.GH_CLOUD_SDK_WRITE_KEY }}" > ~/.ssh/id_rsa
44-
chmod 600 ~/.ssh/id_rsa
45-
cat <<EOT >> ~/.ssh/config
46-
Host github.com
47-
HostName github.com
48-
IdentityFile ~/.ssh/id_rsa
49-
EOT
50-
36+
37+
- uses: actions/create-github-app-token@v3
38+
id: app-token
39+
with:
40+
app-id: ${{ secrets.SAP_CLOUD_SDK_BOT_CLIENT_ID }}
41+
private-key: ${{ secrets.SAP_CLOUD_SDK_BOT_PRIVATE_KEY }}
42+
owner: SAP
43+
repositories: cloud-sdk
44+
permission-contents: write
45+
5146
- name: Push generated API documentation to cloud-sdk repo
5247
env:
53-
USE_SSH: true
48+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
5449
GIT_USER: cloud-sdk-js
50+
BOT_EMAIL: ${{ vars.SAP_CLOUD_SDK_BOT_EMAIL }}
51+
BOT_NAME: ${{ vars.SAP_CLOUD_SDK_BOT_NAME }}
5552
run: |
56-
git config --global user.email "[email protected]"
57-
git config --global user.name "cloud-sdk-js"
58-
53+
gh auth setup-git
54+
git config user.email "$BOT_EMAIL"
55+
git config user.name "$BOT_NAME"
56+
5957
# Extract major version from input (e.g., v4.5.0 -> v4)
6058
FULL_VERSION="${{ inputs.version }}"
6159
MAJOR_VERSION=$(echo $FULL_VERSION | sed 's/\(v[0-9]*\).*/\1/')
62-
60+
6361
cd ..
64-
git clone --depth 1 git@github.com:SAP/cloud-sdk.git
65-
62+
git clone --depth 1 https://github.com/SAP/cloud-sdk.git
63+
6664
# Copy generated docs to versioned folder
6765
rsync -avz --delete cloud-sdk-js/knowledge-base/api-reference/ cloud-sdk/static/api/${MAJOR_VERSION}/
6866

.github/workflows/auto-dependabot-fix.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,19 @@ jobs:
88
if: github.actor == 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
99
runs-on: ubuntu-latest
1010
steps:
11+
- uses: actions/create-github-app-token@v3
12+
id: app-token
13+
with:
14+
app-id: ${{ secrets.SAP_CLOUD_SDK_BOT_CLIENT_ID }}
15+
private-key: ${{ secrets.SAP_CLOUD_SDK_BOT_PRIVATE_KEY }}
16+
owner: SAP
17+
repositories: cloud-sdk-js
18+
permission-contents: write
1119
- uses: actions/checkout@v6
1220
with:
1321
fetch-depth: 0
1422
ref: ${{ github.event.pull_request.head.ref }}
15-
token: ${{ secrets.GH_CLOUD_SDK_JS_ADMIN_WRITE_TOKEN }}
23+
token: ${{ steps.app-token.outputs.token }}
1624
- run: git fetch --depth=1
1725
- uses: actions/setup-node@v6
1826
with:

.github/workflows/auto-lint.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,19 @@ jobs:
88
if: github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
99
runs-on: ubuntu-latest
1010
steps:
11+
- uses: actions/create-github-app-token@v3
12+
id: app-token
13+
with:
14+
app-id: ${{ secrets.SAP_CLOUD_SDK_BOT_CLIENT_ID }}
15+
private-key: ${{ secrets.SAP_CLOUD_SDK_BOT_PRIVATE_KEY }}
16+
owner: SAP
17+
repositories: cloud-sdk-js
18+
permission-contents: write
1119
- uses: actions/checkout@v6
1220
with:
1321
fetch-depth: 0
1422
ref: ${{ github.event.pull_request.head.ref }}
15-
token: ${{ secrets.GH_CLOUD_SDK_JS_ADMIN_WRITE_TOKEN }}
23+
token: ${{ steps.app-token.outputs.token }}
1624
- run: git fetch --depth=1
1725
- uses: actions/setup-node@v6
1826
with:

.github/workflows/bump.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,17 @@ jobs:
1313
outputs:
1414
version: ${{ steps.bump.outputs.version }}
1515
steps:
16+
- uses: actions/create-github-app-token@v3
17+
id: app-token
18+
with:
19+
app-id: ${{ secrets.SAP_CLOUD_SDK_BOT_CLIENT_ID }}
20+
private-key: ${{ secrets.SAP_CLOUD_SDK_BOT_PRIVATE_KEY }}
21+
owner: SAP
22+
repositories: cloud-sdk-js
23+
permission-contents: write
1624
- uses: actions/checkout@v6
1725
with:
18-
token: ${{ secrets.GH_CLOUD_SDK_JS_ADMIN_WRITE_TOKEN }}
26+
token: ${{ steps.app-token.outputs.token }}
1927
ref: 'main'
2028

2129
- uses: actions/setup-node@v6

.github/workflows/fosstars-report.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ jobs:
88
create_fosstars_report:
99
runs-on: ubuntu-latest
1010
name: 'Security rating'
11+
permissions:
12+
contents: write
1113
steps:
1214
- uses: actions/checkout@v6
1315
- uses: SAP/[email protected]
1416
with:
1517
report-branch: fosstars-report
16-
token: '${{ secrets.GH_CLOUD_SDK_JS_ADMIN_WRITE_TOKEN }}'
18+
token: ${{ secrets.GITHUB_TOKEN }}
1719
- if: failure() || cancelled()
1820
name: Slack Notify
1921
uses: rtCamp/[email protected]

0 commit comments

Comments
 (0)