~sircmpwn/sr.ht-docs

eaf07004e440b78c5b81723cffec2933635f750b — Drew DeVault 6 months ago 3fbfaca
Add explanation of what's going on in README command
1 files changed, 26 insertions(+), 0 deletions(-)

M git.sr.ht/index.md
M git.sr.ht/index.md => git.sr.ht/index.md +26 -0
@@ 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.