Skip to content
This repository was archived by the owner on Nov 29, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/actions/get_penultimate_release/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Get Penultimate Release
description: Get's Penultimate Release and kicks off the rollback release workflow.
inputs:
token:
required: true
description: Github Password
outputs:
goodRelease:
description: The tag of the release that we want to rollback to.
badRelease:
description: This is the tag of the latest/faulty release that we want to delete.

runs:
using: 'node16'
main: 'index.js'

35 changes: 35 additions & 0 deletions .github/actions/get_penultimate_release/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const { Octokit } = require("@octokit/core")
const core = require('@actions/core');


async function getReleaseTags() {
const octokit = new Octokit({
auth: process.env.GITHUB_TOKEN
})

const { data } = await octokit.request('GET /repos/Bandwidth/api-docs/tags', {
owner: 'Bandwidth',
repo: 'api-docs'
})

const badRelease = data[0].name
const goodRelease = data[1].name

core.setOutput("badRelease", badRelease)
core.setOutput("goodRelease", goodRelease)


// Change workflow_id for proper rollback-release workflow id once that workflow is merged into main.
await octokit.request('POST /repos/Bandwidth/api-docs/actions/workflows/rollback-release/dispatches', {
owner: 'Bandwidth',
repo: 'api-docs',
workflow_id: 'rollback-release',
ref: goodRelease,
inputs: {
tag_to_delete: badRelease,
}

})
}

getReleaseTags();
Loading