Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVelezLl committed Jan 9, 2025
1 parent f298787 commit dd8195b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 29 deletions.
30 changes: 4 additions & 26 deletions .github/GithubAPI.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,9 @@
const axios = require("axios");

module.exports = class GithubAPI {
constructor(owner, github) {
this.owner = owner;
this.github = github;
}

async query(query, variables) {
try {
const response = await this.github.graphql(
query,
variables
);

console.log("Response", response);

if (response.data.errors) {
throw new Error(JSON.stringify(response.data.errors, null, 2));
}

return response.data;
} catch (error) {
console.error(error);
throw error;
}
}

async getSourceAndTargetProjects({ sourceNumber, targetNumber }) {
const projectSubquery = `
id
Expand All @@ -45,7 +23,7 @@ module.exports = class GithubAPI {
`;
const query = `
query getSourceAndTargetProjectsIds($owner: String!, $source: Int!, $target: Int!) {
user (login: $owner) {
organization (login: $owner) {
source: projectV2(number: $source) {
${projectSubquery}
}
Expand All @@ -56,7 +34,7 @@ module.exports = class GithubAPI {
}
`;

const response = await this.query(query, {
const response = await this.github.graphql(query, {
owner: this.owner,
source: sourceNumber,
target: targetNumber,
Expand Down Expand Up @@ -134,7 +112,7 @@ module.exports = class GithubAPI {
`;

const _getProjectItems = async (cursor = null, items = []) => {
const response = await this.query(query, {
const response = await this.github.graphql(query, {
projectId,
cursor
});
Expand Down Expand Up @@ -174,7 +152,7 @@ module.exports = class GithubAPI {
const batch = items.slice(i, i + BATCH_SIZE);

await Promise.all(batch.map(async item => {
await this.query(query, {
await this.github.graphql(query, {
projectId: item.projectId,
itemId: item.projectItemId,
fieldId: item.fieldId,
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/sync_kds_roadmap_statuses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ jobs:
with:
node-version: '18'

- name: Install axios
run: npm install axios

- uses: tibdex/github-app-token@v1
id: generate-token
with:
Expand Down

0 comments on commit dd8195b

Please sign in to comment.