Skip to content

Commit

Permalink
change env variable for github aggregator
Browse files Browse the repository at this point in the history
  • Loading branch information
aluedeke committed Dec 6, 2024
1 parent cbe74e4 commit b40a6ec
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/aggregator/github-aggregator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { WebhookAlertDto } from "../checkly/alertDTO";
import { CheckContext, ContextKey } from "./ContextAggregator";
import moment from "moment";

const githubApi = new GitHubAPI(process.env.GITHUB_TOKEN || "");
const githubApi = new GitHubAPI(process.env.CHECKLY_GITHUB_TOKEN || "");

interface RepoChange {
repo: string;
Expand Down
5 changes: 5 additions & 0 deletions src/github/github.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ const CHECKLY_GITHUB_TOKEN = process.env.CHECKLY_GITHUB_TOKEN!;

describe('GitHub API Tests', () => {

it.skip('should print the api usage', async () => {
const githubAPI = new GitHubAPI(CHECKLY_GITHUB_TOKEN);
await githubAPI.checkRateLimit();
});

it.skip('should return the latest releases for checkly', async () => {
const githubAPI = new GitHubAPI(CHECKLY_GITHUB_TOKEN);
const org = 'checkly';
Expand Down
1 change: 1 addition & 0 deletions src/github/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class GitHubAPI {
async checkRateLimit() {
try {
const response = await this.octokit.rest.rateLimit.get();
console.log(response.data);

if (response.data.resources.core.remaining === 0) {
throw new Error("Rate limit exceeded");
Expand Down

0 comments on commit b40a6ec

Please sign in to comment.