Skip to content
This repository was archived by the owner on Nov 29, 2023. It is now read-only.

Commit fcc49b9

Browse files
authored
Merge branch 'main' into BWDB-13410
2 parents e5d1b11 + 5f2ada6 commit fcc49b9

File tree

487 files changed

+23855
-40125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

487 files changed

+23855
-40125
lines changed

.github/actions/add_pr_comment/action.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/actions/publish-specs/Dockerfile

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/actions/publish-specs/action.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/actions/publish-specs/entrypoint.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/actions/push-to-sdk-repo/Dockerfile

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/actions/push-to-sdk-repo/action.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/actions/push-to-sdk-repo/entrypoint.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 64 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name: Replace Specs and Snippets
22
description: Replaces specs with specs from api-specs repository and code-snippets from api-docs-code-snippets repository
3-
inputs:
4-
branch-name:
3+
inputs:
4+
branch-name:
55
required: true
66
description: Desired Branch Name
7-
username:
7+
username:
88
required: true
99
description: Github Username
10-
token:
10+
token:
1111
required: true
1212
description: Github Token
1313
origin-repo:
@@ -17,71 +17,70 @@ inputs:
1717
required: true
1818
description: Origin PR Author
1919

20-
outputs:
21-
needs_pr:
20+
outputs:
21+
needs_pr:
2222
description: "Whether or not a PR needs to be opened for the corresponding branch"
23-
value: ${{ steps.branch_create.outputs.needs_pr }}
23+
value: ${{ steps.branch_create.outputs.NEEDS_PR }}
2424

25-
2625
runs:
27-
using: "composite"
28-
steps:
29-
- uses: actions/checkout@v2
30-
with:
31-
token: ${{ inputs.token }}
26+
using: "composite"
27+
steps:
28+
- uses: actions/checkout@v2
29+
with:
30+
token: ${{ inputs.token }}
3231

33-
- name: Create or Checkout Branch
34-
id: branch_create
35-
run: |
36-
git config user.email "[email protected]"
37-
git config user.name ${{ inputs.username }}
38-
if [ "$(git ls-remote --heads https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-docs.git ${{ inputs.branch-name }} | wc -l)" -eq 1 ]
39-
then
40-
git fetch
41-
git checkout ${{ inputs.branch-name }}
42-
else
43-
git checkout -b ${{ inputs.branch-name }}
44-
echo "::set-output name=needs_pr::true"
45-
fi
46-
shell: bash
32+
- name: Create or Checkout Branch
33+
id: branch_create
34+
run: |
35+
git config user.email "[email protected]"
36+
git config user.name ${{ inputs.username }}
37+
if [ "$(git ls-remote --heads https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-docs.git ${{ inputs.branch-name }} | wc -l)" -eq 1 ]
38+
then
39+
git fetch
40+
git checkout ${{ inputs.branch-name }}
41+
else
42+
git checkout -b ${{ inputs.branch-name }}
43+
echo "NEEDS_PR=true" >> $GITHUB_OUTPUT
44+
fi
45+
shell: bash
4746

48-
- name: Copy Api Specs
49-
run: |
50-
mkdir api-specs
51-
if [ ${{ inputs.origin-repo }} = api-specs ]
52-
then
53-
git clone --branch ${{ inputs.branch-name }} https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-specs api-specs
54-
else
55-
git clone https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-specs api-specs
56-
fi
57-
rm -r api-specs/.git
58-
cp -TRv api-specs/external site/specs
59-
rm -r api-specs
60-
shell: bash
47+
- name: Copy Api Specs
48+
run: |
49+
mkdir api-specs
50+
if [ ${{ inputs.origin-repo }} = api-specs ]
51+
then
52+
git clone --branch ${{ inputs.branch-name }} https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-specs api-specs
53+
else
54+
git clone https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-specs api-specs
55+
fi
56+
rm -r api-specs/.git
57+
cp -TRv api-specs/external site/specs
58+
rm -r api-specs
59+
shell: bash
6160

62-
- name: Copy Code Snippets
63-
run: |
64-
mkdir code-snippets
65-
if [ ${{ inputs.origin-repo }} = api-docs-code-snippets ]
66-
then
67-
git clone --branch ${{ inputs.branch-name }} https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-docs-code-snippets code-snippets
68-
else
69-
git clone https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-docs-code-snippets code-snippets
70-
fi
71-
rm -r code-snippets/.git
72-
mkdir site/code-snippets
73-
cp -TR code-snippets/external site/code-snippets
74-
mv -v code-snippets/add-code-snippets-oas.js code-snippets/package.json code-snippets/env-replace site/code-snippets
75-
rm -r code-snippets
76-
shell: bash
61+
- name: Copy Code Snippets
62+
run: |
63+
mkdir code-snippets
64+
if [ ${{ inputs.origin-repo }} = api-docs-code-snippets ]
65+
then
66+
git clone --branch ${{ inputs.branch-name }} https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-docs-code-snippets code-snippets
67+
else
68+
git clone https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-docs-code-snippets code-snippets
69+
fi
70+
rm -r code-snippets/.git
71+
mkdir site/code-snippets
72+
cp -TR code-snippets/external site/code-snippets
73+
mv -v code-snippets/add-code-snippets-oas.js code-snippets/package.json code-snippets/env-replace site/code-snippets
74+
rm -r code-snippets
75+
shell: bash
7776

78-
- name: Generate Code Snippets
79-
run: |
80-
cd site/code-snippets
81-
npm install
82-
node add-code-snippets-oas.js
83-
cd ..
84-
git add ./specs/*
85-
git commit -m "Add Code Snippets to Spec Files"
86-
git push origin ${{ inputs.branch-name }}
87-
shell: bash
77+
- name: Generate Code Snippets
78+
run: |
79+
cd site/code-snippets
80+
npm install
81+
node add-code-snippets-oas.js
82+
cd ..
83+
git add ./specs/*
84+
git commit -m "Add Code Snippets to Spec Files"
85+
git push origin ${{ inputs.branch-name }}
86+
shell: bash
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: Rollback Release
2+
description: Takes the latest release and converts it to a draft and then kicks off a workflow dispatch to publish the previous release to AWS.
3+
outputs:
4+
goodRelease:
5+
description: The tag of the release that we want to rollback to.
6+
runs:
7+
using: 'node16'
8+
main: 'index.js'
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const { Octokit } = require("@octokit/core")
2+
const core = require('@actions/core');
3+
4+
5+
async function rollbackRelease() {
6+
const octokit = new Octokit({
7+
auth: process.env.GITHUB_TOKEN
8+
})
9+
10+
const { data } = await octokit.request('GET /repos/Bandwidth/api-docs/releases', {
11+
owner: 'Bandwidth',
12+
repo: 'api-docs'
13+
})
14+
15+
const cleanedData = []
16+
const cleanData = (data) => {
17+
for (const x in data) {
18+
if (data[x].draft === false && data[x].prerelease === false) {
19+
cleanedData.push(data[x])
20+
}
21+
}
22+
}
23+
24+
cleanData(data)
25+
cleanedData.sort((a,b) => (a.published_at > b.published_at) ? -1 : ((b.published_at > a.published_at) ? 1 : 0));
26+
27+
const badRelease = cleanedData[0].name
28+
const badReleaseId = cleanedData[0].id
29+
const goodRelease = cleanedData[1].name
30+
31+
core.setOutput("goodRelease", goodRelease)
32+
33+
await octokit.request(`PATCH /repos/Bandwidth/api-docs/releases/${badReleaseId}`, {
34+
tag_name: badRelease,
35+
draft: true,
36+
})
37+
38+
await octokit.request('POST /repos/Bandwidth/api-docs/actions/workflows/3796239/dispatches', {
39+
ref: goodRelease,
40+
})
41+
}
42+
43+
rollbackRelease();

0 commit comments

Comments
 (0)