Skip to content

Commit

Permalink
remove label conditional and switch to removal instead of archiving
Browse files Browse the repository at this point in the history
  • Loading branch information
DitwanP committed Jan 16, 2025
1 parent 2989c51 commit 37f878b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const { execSync } = require("child_process");
const owner = process.env.OWNER;
const repo = process.env.REPO;
const issueNumber = process.env.ISSUE_NUMBER;
const labelName = process.env.LABEL_NAME;

// Function to execute a GitHub GraphQL command
function runQuery(query) {
Expand Down Expand Up @@ -50,16 +49,12 @@ try {
console.log("Project Item:", projectItem);

if (projectItem) {
if (labelName === "ready for dev") {
const archiveQuery = `mutation { archiveProjectV2Item(input: {projectId: "${projectItem.project.id}", itemId: "${projectItem.id}"}) { clientMutationId } }`;
runQuery(archiveQuery);
createComment(
`The design work for this issue has been completed and it is now ready for development.\n\nThe issue has been archived in the [${projectItem.project.title}](${projectItem.project.url}/archive) project.`,
);
console.log("Issue archived in project.");
} else {
console.log("No action taken, label added was not 'ready for dev'.");
}
const deleteQuery = `mutation { deleteProjectV2Item(input: {projectId: "${projectItem.project.id}", itemId: "${projectItem.id}"}) { clientMutationId } }`;
runQuery(deleteQuery);
createComment(
`The issue has been removed from the [${projectItem.project.title}](${projectItem.project.url}) project.`,
);
console.log("Issue removed from project.");
} else {
console.log("No associated project found for this issue.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
process-labeled-issue:
if: github.event.label.name == 'ready for dev'
runs-on: ubuntu-latest

steps:
Expand All @@ -23,5 +24,4 @@ jobs:
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
LABEL_NAME: ${{ github.event.label.name }}
run: node .github/scripts/archiveIssuesInDesignProjects.js
run: node .github/scripts/removeIssuesFromDesignProjects.js

0 comments on commit 37f878b

Please sign in to comment.