Skip to content

Commit

Permalink
require gh token
Browse files Browse the repository at this point in the history
  • Loading branch information
sduranc committed Oct 29, 2024
1 parent aa98587 commit 7542a97
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Release Action
name: Build and Release send-ci-cd-trace Action

on:
push:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/grafana-annotation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ jobs:
connection_string: ${{ secrets.APP_INSIGHTS_CONNECTION_STRING }}
app: "${{ github.event.inputs.app }}"
team: "${{ github.event.inputs.team }}"
repo_token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion actions/send-ci-cd-trace/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ inputs:
required: true
repo_token:
description: 'GitHub Token for accessing workflow data in private repositories'
required: false
required: true
runs:
using: 'node20'
main: 'dist/index.js'
5 changes: 2 additions & 3 deletions actions/send-ci-cd-trace/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ async function run() {
const connectionString = core.getInput("connection_string");
const app = core.getInput("app");
const team = core.getInput("team");
const token = core.getInput("repo_token")

if (!connectionString) {
throw new Error("Application Insights connection string is required.");
Expand All @@ -28,10 +29,8 @@ async function run() {
throw new Error("Team name is required.");
}

let token = core.getInput("repo_token") || process.env.GITHUB_TOKEN;

if (!token) {
throw new Error("GitHub token is required. Ensure 'repo_token' input or GITHUB_TOKEN environment variable is provided.");
throw new Error("GitHub token is required. Ensure 'repo_token' input is provided.");
}

// Add default attributes to spans
Expand Down

0 comments on commit 7542a97

Please sign in to comment.