Skip to content

Commit

Permalink
fix: action debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
devthejo committed Jan 7, 2025
1 parent d2dbae6 commit cc7d4d3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/action/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ async function run() {
const tokenBureauUrl = core.getInput('token-bureau-url', { required: true });
const audience = core.getInput('audience', { required: true });

core.debug(`Using token-bureau-url: ${tokenBureauUrl}`);
core.debug(`Using audience: ${audience}`);
console.log(`Using token-bureau-url: ${tokenBureauUrl}`);
console.log(`Using audience: ${audience}`);

// Get OIDC token from GitHub Actions
const idToken = await core.getIDToken(audience);
core.debug('Successfully obtained OIDC token');
console.log('Successfully obtained OIDC token');

// Extract current repository from environment
const repository = process.env.GITHUB_REPOSITORY?.split('/')[1];
if (!repository) {
throw new Error('GITHUB_REPOSITORY environment variable is not set');
}
core.debug(`Repository: ${repository}`);
console.log(`Repository: ${repository}`);

// Request token from TokenBureau
core.debug('Sending request to TokenBureau');
console.log('Sending request to TokenBureau');
const response = await fetch(`${tokenBureauUrl}/generate-token`, {
method: 'POST',
headers: {
Expand All @@ -35,7 +35,7 @@ async function run() {
})
});

core.debug(`Response status: ${response.status}`);
console.log(`Response status: ${response.status}`);

if (!response.ok) {
const error = await response.text();
Expand All @@ -44,15 +44,15 @@ async function run() {
}

const data = await response.json();
core.debug('Successfully received token response');
console.log('Successfully received token response');

// Set outputs
core.setSecret(data.token);
core.setOutput('token', data.token);
core.setOutput('expires_at', data.expires_at);
core.setOutput('installation_id', data.installation_id);

core.debug('Action completed successfully');
console.log('Action completed successfully');
} catch (error) {
core.error(`Action failed: ${error.message}`);
core.setFailed(error.message);
Expand Down

0 comments on commit cc7d4d3

Please sign in to comment.