Skip to content

Commit

Permalink
fix: up to use new GITHUB_CLIENT_ID api + wip
Browse files Browse the repository at this point in the history
  • Loading branch information
devthejo committed Jan 7, 2025
1 parent 215727a commit 3def986
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
PORT=3000

# GitHub App Configuration
GITHUB_APP_ID=123456
# You can use either GITHUB_CLIENT_ID (recommended) or GITHUB_APP_ID
GITHUB_CLIENT_ID=123456
# GITHUB_APP_ID=123456 # Legacy option, GITHUB_CLIENT_ID is preferred

# Private key can be in any of these formats:

Expand Down
5 changes: 5 additions & 0 deletions examples/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ jobs:
id: token
uses: SocialGouv/token-bureau@main
with:
# The URL where your token-bureau server is running
# Make sure this matches your deployment URL
token-bureau-url: https://your-token-bureau-service.com

# The audience value must match OIDC_AUDIENCE in your server's environment
# This is used to validate the OIDC token
audience: your-audience-value

# Example: Use the token to create a release
Expand Down
9 changes: 7 additions & 2 deletions packages/server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ dotenv.config({ path: join(__dirname, '..', '.env') });

// Required environment variables
const requiredEnvVars = [
'GITHUB_APP_ID',
'GITHUB_PRIVATE_KEY',
'OIDC_AUDIENCE'
];

// At least one of these is required
if (!process.env.GITHUB_APP_ID && !process.env.GITHUB_CLIENT_ID) {
throw new Error('Either GITHUB_APP_ID or GITHUB_CLIENT_ID must be provided');
}

// Validate required environment variables
for (const envVar of requiredEnvVars) {
if (!process.env[envVar]) {
Expand Down Expand Up @@ -96,7 +100,8 @@ const loggerConfig = {
export default {
port: process.env.PORT || 3000,
github: {
appId: process.env.GITHUB_APP_ID,
// Prefer client ID if available, fall back to app ID
appId: process.env.GITHUB_CLIENT_ID || process.env.GITHUB_APP_ID,
privateKey: privateKey
},
oidc: {
Expand Down

0 comments on commit 3def986

Please sign in to comment.