diff --git a/.github/workflows/add_to_project.yml b/.github/workflows/add_to_project.yml deleted file mode 100644 index 4b5d53a..0000000 --- a/.github/workflows/add_to_project.yml +++ /dev/null @@ -1,117 +0,0 @@ -name: Add Issues to Project - -on: - issues: - types: - - opened - -jobs: - add-to-project: - name: Add issue to project - runs-on: ubuntu-latest - steps: - - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} - script: | - const issue = context.payload.issue; - - // Get project ID - const projectOwner = 'drf-forms'; - const projectNumber = 1; - - // Query for the project ID - const projectQuery = ` - query($owner: String!, $number: Int!) { - user(login: $owner) { - projectV2(number: $number) { - id - fields(first: 20) { - nodes { - ... on ProjectV2SingleSelectField { - id - name - options { - id - name - } - } - } - } - } - } - } - `; - - const projectData = await github.graphql(projectQuery, { - owner: projectOwner, - number: projectNumber - }); - - const projectId = projectData.user.projectV2.id; - - // Find status field ID and the "Idea" option ID - let statusFieldId; - let ideaOptionId; - - const fields = projectData.user.projectV2.fields.nodes; - for (const field of fields) { - if (field.name === 'Status') { - statusFieldId = field.id; - for (const option of field.options) { - if (option.name === 'Idea') { - ideaOptionId = option.id; - break; - } - } - break; - } - } - - // Add issue to project - const addToProjectMutation = ` - mutation($projectId: ID!, $contentId: ID!) { - addProjectV2ItemById(input: { - projectId: $projectId - contentId: $contentId - }) { - item { - id - } - } - } - `; - - const addResult = await github.graphql(addToProjectMutation, { - projectId: projectId, - contentId: issue.node_id - }); - - // If status field and Idea option were found, set the status - if (statusFieldId && ideaOptionId) { - const itemId = addResult.addProjectV2ItemById.item.id; - - const updateFieldMutation = ` - mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $optionId: String!) { - updateProjectV2ItemFieldValue(input: { - projectId: $projectId - itemId: $itemId - fieldId: $fieldId - value: { - singleSelectOptionId: $optionId - } - }) { - projectV2Item { - id - } - } - } - `; - - await github.graphql(updateFieldMutation, { - projectId: projectId, - itemId: itemId, - fieldId: statusFieldId, - optionId: ideaOptionId - }); - } diff --git a/.github/workflows/new_issue_first_comment.yml b/.github/workflows/new_issue_first_comment.yml index 8125f6a..021192d 100644 --- a/.github/workflows/new_issue_first_comment.yml +++ b/.github/workflows/new_issue_first_comment.yml @@ -38,17 +38,3 @@ jobs: repo: context.repo.repo, body: commentBody }); - move-issue-to-repository-project-column: - name: Move issues to repository project column - runs-on: ubuntu-latest - permissions: - issues: write - repository-projects: write - steps: - - name: Assign new issues to project new-features - uses: actions/add-to-project@v0.5.0 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - project-url: 'https://github.com/orgs/django/projects/24' - labeled: this-is-a-dirty-hack-but-i-m-getting-tired-of-this - label-operator: NOT