From eaf07004e440b78c5b81723cffec2933635f750b Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 25 Jan 2021 11:04:22 -0500 Subject: Add explanation of what's going on in README command --- git.sr.ht/index.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'git.sr.ht') diff --git a/git.sr.ht/index.md b/git.sr.ht/index.md index 2a1a662..f072ee6 100644 --- a/git.sr.ht/index.md +++ b/git.sr.ht/index.md @@ -147,6 +147,32 @@ jq -R '{ -d@- https://git.sr.ht/query ``` +This looks a bit complicated, so to explain what's happening here: we want to +execute the following GraphQL request: + +``` +mutation UpdateRepo($id: Int!, $readme: String!) { + updateRepository(id: 60, input: { readme: $readme }) { id } +} +``` + +The [jq](https://stedolan.github.io/jq) command takes the input (your README +file) and incorporates it into a JSON string with the following format: + +``` +{ + "query": "the desired GraphQL query...", + "variables": { + "id": 1337, + "readme": "your README HTML..." + } +} +``` + +This is [the input](https://man.sr.ht/graphql.md#performing-graphql-queries) to +the git.sr.ht GraphQL endpoint at `git.sr.ht/graphql`, which is piped from jq +into [curl](https://curl.se) to send the request to git.sr.ht. + It may be desirable to configure a builds.sr.ht job to compile your README from another markup format and submit it on each git push. If so, you will need to review the [build secrets tutorial][secrets] to safely store your OAuth token. -- cgit