GitHub Action commited on
Commit
15e2717
·
1 Parent(s): afcd954

Sync from GitHub with Git LFS

Browse files
Files changed (1) hide show
  1. scripts/publish_to_hashnode.py +12 -5
scripts/publish_to_hashnode.py CHANGED
@@ -56,17 +56,24 @@ def create_post(title, slug, markdown_content):
56
  "slug": slug, "publicationId": HASHNODE_PUBLICATION_ID}}
57
  return graphql_request(query, variables)["data"]["createDraft"]["draft"]
58
 
59
- def update_post(post_id, title, markdown_content):
60
  query = """
61
- mutation UpdateDraft($id: ID!, $input: UpdateDraftInput!) {
62
- updateDraft(id: $id, input: $input) {
63
- draft { id slug title }
64
  }
65
  }
66
  """
67
- variables = {"id": post_id, "input": {"title": title, "contentMarkdown": markdown_content}}
 
 
 
 
 
 
68
  return graphql_request(query, variables)["data"]["updateDraft"]["draft"]
69
 
 
70
  def publish_draft(draft_id):
71
  query = """
72
  mutation PublishDraft($input: PublishDraftInput!) {
 
56
  "slug": slug, "publicationId": HASHNODE_PUBLICATION_ID}}
57
  return graphql_request(query, variables)["data"]["createDraft"]["draft"]
58
 
59
+ def update_post(slug, title, markdown_content):
60
  query = """
61
+ mutation UpdateDraft($slug: String!, $input: UpdateDraftInput!) {
62
+ updateDraft(slug: $slug, input: $input) {
63
+ draft { slug title id }
64
  }
65
  }
66
  """
67
+ variables = {
68
+ "slug": slug,
69
+ "input": {
70
+ "title": title,
71
+ "contentMarkdown": markdown_content
72
+ }
73
+ }
74
  return graphql_request(query, variables)["data"]["updateDraft"]["draft"]
75
 
76
+
77
  def publish_draft(draft_id):
78
  query = """
79
  mutation PublishDraft($input: PublishDraftInput!) {