Skip to content

Commit 45fcabe

Browse files
emrysaldevin-ai-integration[bot]anikdhabal
authored
chore: replace GH_ACCESS_TOKEN with GitHub App token (calcom#25518)
* chore: replace GH_ACCESS_TOKEN with GitHub App token Replace personal access token (GH_ACCESS_TOKEN) with GitHub App token generation using actions/create-github-app-token@v1 for improved security. Updated workflows: - draft-release.yml - post-release.yml - cleanup.yml - cleanup-report.yml - publish-report.yml - i18n.yml Benefits: - Short-lived tokens (1 hour) vs long-lived PATs - Fine-grained, scoped permissions - Not tied to individual user accounts - Better audit trail Required setup: - Create a GitHub App with contents:write permission - Install the app on calcom/cal.com and calcom/test-results-2 - Add RELEASE_APP_ID and RELEASE_APP_PRIVATE_KEY secrets Co-Authored-By: alex@cal.com <me@alexvanandel.com> * chore: rename secrets to CI_CAL_APP_ID and CI_CAL_APP_PRIVATE_KEY Co-Authored-By: alex@cal.com <me@alexvanandel.com> * chore: use reusable workflow from calcom-ci-secrets for token generation This isolates the GitHub App private key in a separate repository, ensuring that compromised actions in cal.com can only access short-lived tokens, not the key itself. Co-Authored-By: alex@cal.com <me@alexvanandel.com> * chore: use explicit secret passing instead of secrets: inherit Only pass the two required secrets (CI_CAL_APP_ID, CI_CAL_APP_PRIVATE_KEY) to the reusable workflow instead of inheriting all secrets. Co-Authored-By: alex@cal.com <me@alexvanandel.com> * chore: remove secrets block - using environment secrets from calcom-ci-secrets Secrets are now loaded from the ci-github-app environment in calcom-ci-secrets, so cal.com workflows no longer need to pass them. Co-Authored-By: alex@cal.com <me@alexvanandel.com> * chore: revert to explicit secret passing Environment secrets in cross-repo reusable workflows don't work as expected. Secrets must be passed explicitly from the caller repository. Co-Authored-By: alex@cal.com <me@alexvanandel.com> * chore: generate GitHub App token directly in workflows Remove dependency on calcom-ci-secrets reusable workflow. Token generation is now inline using actions/create-github-app-token pinned to SHA 7e473efe3cb98aa54f8d4bac15400b15fad77d94 (v2.2.0). Co-Authored-By: alex@cal.com <me@alexvanandel.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
1 parent 593ed46 commit 45fcabe

6 files changed

Lines changed: 58 additions & 8 deletions

File tree

.github/workflows/cleanup-report.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,20 @@ jobs:
1111
cleanup-report:
1212
runs-on: ubuntu-latest
1313
steps:
14+
- name: Generate GitHub App token
15+
id: generate-token
16+
uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94
17+
with:
18+
app-id: ${{ secrets.CI_CAL_APP_ID }}
19+
private-key: ${{ secrets.CI_CAL_APP_PRIVATE_KEY }}
20+
repositories: 'test-results-2'
21+
1422
- name: Checkout GitHub Pages Branch
1523
uses: actions/checkout@v4
1624
with:
1725
repository: calcom/test-results-2
1826
ref: gh-pages
19-
token: ${{ secrets.GH_ACCESS_TOKEN }}
27+
token: ${{ steps.generate-token.outputs.token }}
2028

2129
- name: Set Git User
2230
run: |

.github/workflows/cleanup.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,20 @@ jobs:
2222
# Contains all reports for deleted branch
2323
BRANCH_REPORTS_DIR: reports/${{ github.event.ref }}
2424
steps:
25+
- name: Generate GitHub App token
26+
id: generate-token
27+
uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94
28+
with:
29+
app-id: ${{ secrets.CI_CAL_APP_ID }}
30+
private-key: ${{ secrets.CI_CAL_APP_PRIVATE_KEY }}
31+
repositories: 'test-results-2'
32+
2533
- name: Checkout GitHub Pages Branch
26-
uses: actions/checkout@v2
34+
uses: actions/checkout@v4
2735
with:
2836
repository: calcom/test-results-2
2937
ref: gh-pages
30-
token: ${{ secrets.GH_ACCESS_TOKEN }}
38+
token: ${{ steps.generate-token.outputs.token }}
3139
- name: Set Git User
3240
# see: https://github.com/actions/checkout/issues/13#issuecomment-724415212
3341
run: |

.github/workflows/draft-release.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,20 @@ jobs:
1717
runs-on: ubuntu-latest
1818

1919
steps:
20-
20+
- name: Generate GitHub App token
21+
id: generate-token
22+
uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94
23+
with:
24+
app-id: ${{ secrets.CI_CAL_APP_ID }}
25+
private-key: ${{ secrets.CI_CAL_APP_PRIVATE_KEY }}
26+
repositories: 'cal.com'
27+
2128
- name: Checkout code
2229
uses: actions/checkout@v4
2330
with:
2431
fetch-depth: 0
2532
ref: 'main'
26-
token: ${{ secrets.GH_ACCESS_TOKEN }}
33+
token: ${{ steps.generate-token.outputs.token }}
2734

2835
- name: Configure git
2936
run: |

.github/workflows/i18n.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,22 @@ jobs:
1616
contents: write
1717
pull-requests: write
1818
steps:
19+
- name: Generate GitHub App token
20+
id: generate-token
21+
uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94
22+
with:
23+
app-id: ${{ secrets.CI_CAL_APP_ID }}
24+
private-key: ${{ secrets.CI_CAL_APP_PRIVATE_KEY }}
25+
repositories: 'cal.com'
26+
1927
- uses: actions/checkout@v4
2028
- uses: actions/setup-node@v4
2129
with:
2230
node-version: 20
2331
cache: 'npm'
2432
- uses: lingodotdev/lingo.dev@main
2533
env:
26-
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
34+
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
2735
with:
2836
api-key: ${{ secrets.CI_LINGO_DOT_DEV_API_KEY }}
2937
pull-request: true

.github/workflows/post-release.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,27 @@ on:
66
tags:
77
- "*"
88

9+
permissions:
10+
contents: write
11+
912
jobs:
1013
release:
1114
runs-on: ubuntu-latest
1215
steps:
16+
- name: Generate GitHub App token
17+
id: generate-token
18+
uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94
19+
with:
20+
app-id: ${{ secrets.CI_CAL_APP_ID }}
21+
private-key: ${{ secrets.CI_CAL_APP_PRIVATE_KEY }}
22+
repositories: 'cal.com'
23+
1324
- name: Checkout code
1425
uses: actions/checkout@v4
1526
with:
1627
fetch-depth: 0
1728
ref: 'main'
18-
token: ${{ secrets.GH_ACCESS_TOKEN }}
29+
token: ${{ steps.generate-token.outputs.token }}
1930

2031
- name: Configure git
2132
run: |

.github/workflows/publish-report.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,20 @@ jobs:
1313
HTML_REPORT_URL_PATH: reports/${{ github.head_ref }}/${{ github.run_id }}/${{ github.run_attempt }}
1414
BRANCH_REPORTS_DIR: reports/${{ github.head_ref }}
1515
steps:
16+
- name: Generate GitHub App token
17+
id: generate-token
18+
uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94
19+
with:
20+
app-id: ${{ secrets.CI_CAL_APP_ID }}
21+
private-key: ${{ secrets.CI_CAL_APP_PRIVATE_KEY }}
22+
repositories: 'test-results-2'
23+
1624
- name: Checkout GitHub Pages Branch
1725
uses: actions/checkout@v4
1826
with:
1927
repository: calcom/test-results-2
2028
ref: gh-pages
21-
token: ${{ secrets.GH_ACCESS_TOKEN }}
29+
token: ${{ steps.generate-token.outputs.token }}
2230
- name: Set Git User
2331
# see: https://github.com/actions/checkout/issues/13#issuecomment-724415212
2432
run: |

0 commit comments

Comments
 (0)