Skip to content

Commit

Permalink
port all issue transfer logic
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisjoshford committed Jun 7, 2024
1 parent e550061 commit b47301e
Showing 1 changed file with 43 additions and 6 deletions.
49 changes: 43 additions & 6 deletions .github/workflows/transfer-issue.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,47 @@
name: Use Shared Workflow
name: Transfer New Issue to Docs Project

on:
issues:
types: [opened, reopened]
types: [opened, reopened]

jobs:
call-shared-workflow:
uses: near-examples/.github/.github/workflows/issue_mirror.yml@main
with:
github-token: ${{ secrets.GH_TOKEN }}
transfer:
runs-on: ubuntu-latest
steps:
- name: Transfer Issue to NEAR DevX
uses: actions/github-script@v5
with:
github-token: ${{secrets.GH_TOKEN}}
script: |
const issueTitle = context.payload.issue.title;
const issueBody = context.payload.issue.body;
const issueNumber = context.payload.issue.number;
const organizationName = 'near';
const projectName = 'NEAR Docs';
// Fetch project ID and other necessary IDs
const query = `
query {
organization(login: "${organizationName}") {
projectV2(number: 117) {
id
}
}
}
`;
const projectIdResponse = await github.graphql(query);
const projectId = projectIdResponse.organization.projectV2.id;
// Add issue to the project
const mutation = `
mutation($projectId: ID!, $contentId: ID!) {
addProjectV2ItemById(input: {projectId: $projectId, contentId: $contentId}) {
item {
id
}
}
}
`;
await github.graphql(mutation, { projectId: projectId, contentId: context.payload.issue.node_id });

0 comments on commit b47301e

Please sign in to comment.