Skip to content

Commit 1c0387a

Browse files
adding additional graphql scripts
1 parent 56ec9c0 commit 1c0387a

6 files changed

+28
-1
lines changed

api/create-repo.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
curl -X POST 'https://api.github.com/orgs/joshjohanning-emu/repos' \
3+
curl -X POST 'https://api.github.com/orgs/joshjohanning-org/repos' \
44
--header "Accept: application/vnd.github.v3+json" \
55
--header "Authorization: Bearer ${PAT}" \
66
-d '{"name":"myrepo2","visibility":"internal"}'
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
curl -X POST 'https://api.github.com/graphql' \
4+
-H "Authorization: bearer ${PAT}" \
5+
--data '{"query":"mutation($input: DeleteBranchProtectionRuleInput!){ deleteBranchProtectionRule(input: $input) { clientMutationId } }","variables":{"input":{"branchProtectionRuleId":"BPR_kwDOGgyPC84BbN2g"}}}'

graphql/get-issue-id.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
curl -X POST 'https://api.github.com/graphql' \
4+
-H "Authorization: bearer ${PAT}" \
5+
--data '{"query":"query FindIssueID { repository(owner:\"joshjohanning-org\", name:\"test-repo\") {issue(number:1) { id } } }","variables":{}}'
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
curl -X POST 'https://api.github.com/graphql' \
4+
-H "Authorization: bearer ${PAT}" \
5+
--data '{"query":"query { repository(owner:\"joshjohanning-org\", name:\"test-repo\") { branchProtectionRules(first: 100) { nodes { pattern, id matchingRefs(first: 100) { nodes { name } } } } } }","variables":{}}'

graphql/get-repository-id.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
curl -X POST 'https://api.github.com/graphql' \
4+
-H "Authorization: bearer ${PAT}" \
5+
--data '{"query":"{ repository(owner: \"joshjohanning-org\", name: \"test-repo\") { id, url }}","variables":{}}'

graphql/transfer-issue.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
# repositoryId is the target repository id (source repository is not needed here)
4+
5+
curl -X POST 'https://api.github.com/graphql' \
6+
-H "Authorization: bearer ${PAT}" \
7+
--data '{"query":"mutation($input: TransferIssueInput!){ transferIssue(input: $input) { clientMutationId issue { id repository { url } repository { name } } } }","variables":{"input":{"issueId":"I_kwDOGgyPC85CNPf4","repositoryId":"R_kgDOGtuZKQ"}}}'

0 commit comments

Comments
 (0)