Skip to content

Commit

Permalink
resolved conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-davidd committed Sep 10, 2023
2 parents 37c6960 + 092e93f commit a252b36
Show file tree
Hide file tree
Showing 7 changed files with 341 additions and 9 deletions.
198 changes: 198 additions & 0 deletions .github/scripts/quickstart_go/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .github/scripts/quickstart_go/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "update_quickstart_go",
"version": "1.0.0",
"description": "Scrapes readme's hopefully",
"main": "update_quickstart_go.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"run": "node update_quickstart_go.js"
},
"author": "Memphis",
"license": "ISC",
"type": "module",
"dependencies": {
"@octokit/request": "^8.1.1",
"@octokit/rest": "^20.0.1"
}
}
85 changes: 85 additions & 0 deletions .github/scripts/quickstart_go/update_quickstart_go.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
const git_token = process.env.DOCS_ACTION_TOKEN

import { Octokit } from "@octokit/rest";

const octokit = new Octokit({
auth: git_token
})

const repos = [
{
repo_name: 'memphis.go',
doc_path: 'docs/sdk/client-libraries/go/quick-start.md',
language_name: 'Go'
},
]

let did_error = false;
const failed_languages = [];
for (let repo of repos){
try {
await update_file(repo.repo_name, repo.doc_path, repo.language_name)
} catch (error) {
console.log();(error);
did_error = true;
failed_languages.push(repo.language_name)
}
}

if (did_error){
throw new Error(`Failed to update one or more languages. \n Failed Languages: ${failed_languages.join(', ')}`)
}

async function update_file(repo_name, doc_path, language_name){
console.log(`Updating ${language_name} Quickstart`);
console.log(`Repo: ${repo_name}`);

console.log(`Getting ${language_name} README`);
let req = await octokit.request('GET /repos/{owner}/{repo}/contents/{path}', {
owner: 'memphisdev',
repo: repo_name,
path: 'README.md',
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
})

console.log(`Getting ${language_name} Quickstart SHA`);
let quick_start = await octokit.request('GET /repos/{owner}/{repo}/contents/{path}', {
owner: 'memphisdev',
repo: 'documentation',
path: doc_path,
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
})

const quick_start_sha = quick_start.data.sha;

console.log(`Quickstart SHA: ${quick_start_sha}`);

const readme_content = atob(req.data.content)
const readme_h3_to_h2 = readme_content.replace(/###/g, '##')
const commit_string = `---
title: ${language_name} Quickstart
description: A quickstart on how to use the ${language_name} client library
---`+ '\n' + readme_h3_to_h2

console.log(`Updating ${language_name} Quickstart`);
await octokit.request('PUT /repos/{owner}/{repo}/contents/{path}', {
owner: 'memphisdev',
repo: 'documentation',
path: doc_path,
message: `Updating ${language_name} SDK Quick-Start`,
committer: {
name: 'Automated Workflow',
email: '[email protected]'
},
content: btoa(commit_string),
headers: {
'X-GitHub-Api-Version': '2022-11-28'
},
sha: quick_start_sha
})
}

25 changes: 25 additions & 0 deletions .github/workflows/auto_update_quick_start.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Auto-Update Go Quickstart Page
on:
push:
branches:
- latest
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
sparse-checkout: .github
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 'latest'
- name: Run quickstart script
env:
REPO_TOKEN: ${{ secrets.DOCS_ACTION_TOKEN }}
run: |
cd ./.github/scripts/quickstart_go
ls
npm ci
node update_quickstart_go.js
17 changes: 9 additions & 8 deletions connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,14 +360,15 @@ func (c *Conn) startConn() error {
var err error
url := opts.Host + ":" + strconv.Itoa(opts.Port)
natsOpts := nats.Options{
Url: url,
AllowReconnect: opts.Reconnect,
MaxReconnect: opts.MaxReconnect,
ReconnectWait: opts.ReconnectInterval,
Timeout: opts.Timeout,
DisconnectedErrCB: disconnectedError,
Name: c.ConnId + "::" + opts.Username,
ClosedCB: DefaultErrHandler,
Url: url,
AllowReconnect: opts.Reconnect,
MaxReconnect: opts.MaxReconnect,
ReconnectWait: opts.ReconnectInterval,
Timeout: opts.Timeout,
DisconnectedErrCB: disconnectedError,
Name: c.ConnId + "::" + opts.Username,
ClosedCB: DefaultErrHandler,
RetryOnFailedConnect: false,
}

if opts.ConnectionToken != "" {
Expand Down
6 changes: 6 additions & 0 deletions consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,17 @@ func (c *Consumer) pingConsumer() {
}(sub)
}
wg.Wait()
<<<<<<< HEAD

Check failure on line 386 in consumer.go

View workflow job for this annotation

GitHub Actions / run-broker-and-test

syntax error: unexpected <<, expecting case or default or }
if generalErr != nil {

Check failure on line 387 in consumer.go

View workflow job for this annotation

GitHub Actions / run-broker-and-test

syntax error: unexpected if, expecting :
if strings.Contains(generalErr.Error(), "consumer not found") || strings.Contains(generalErr.Error(), "stream not found") {

Check failure on line 388 in consumer.go

View workflow job for this annotation

GitHub Actions / run-broker-and-test

syntax error: unexpected if, expecting expression
c.subscriptionActive = false
c.callErrHandler(ConsumerErrStationUnreachable)
}
=======

Check failure on line 392 in consumer.go

View workflow job for this annotation

GitHub Actions / run-broker-and-test

syntax error: unexpected ==, expecting case or default or }
if generalErr != nil && (strings.Contains(generalErr.Error(), "consumer not found") || strings.Contains(generalErr.Error(), "stream not found")) {

Check failure on line 393 in consumer.go

View workflow job for this annotation

GitHub Actions / run-broker-and-test

syntax error: unexpected if, expecting :
c.subscriptionActive = false
c.callErrHandler(ConsumerErrStationUnreachable)
>>>>>>> origin/master

Check failure on line 396 in consumer.go

View workflow job for this annotation

GitHub Actions / run-broker-and-test

syntax error: unexpected >>, expecting case or default or }
}

Check failure on line 397 in consumer.go

View workflow job for this annotation

GitHub Actions / run-broker-and-test

syntax error: unexpected }, expecting :
case <-c.pingQuit:
ticker.Stop()
Expand Down
2 changes: 1 addition & 1 deletion version-beta.conf
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.2-beta.1
1.1.3-beta.1

0 comments on commit a252b36

Please sign in to comment.