1
0
mirror of synced 2026-01-06 06:02:35 -05:00

Merge pull request #10340 from github/repo-sync

repo sync
This commit is contained in:
Octomerger Bot
2021-09-27 16:47:00 -04:00
committed by GitHub
7 changed files with 71 additions and 15 deletions

View File

@@ -101,11 +101,18 @@ jobs:
const Heroku = require('heroku-client')
const heroku = new Heroku({ token: process.env.HEROKU_API_TOKEN })
const { source_blob: sourceBlob } = await heroku.post('/sources')
const { put_url: uploadUrl, get_url: downloadUrl } = sourceBlob
try {
const { source_blob: sourceBlob } = await heroku.post('/sources')
const { put_url: uploadUrl, get_url: downloadUrl } = sourceBlob
core.setOutput('upload_url', uploadUrl)
core.setOutput('download_url', downloadUrl)
core.setOutput('upload_url', uploadUrl)
core.setOutput('download_url', downloadUrl)
} catch (error) {
if (error.statusCode === 503) {
console.error('💀 Heroku may be down! Please check its Status page: https://status.heroku.com/')
}
throw error
}
# See: https://devcenter.heroku.com/articles/build-and-release-using-the-api#sources-endpoint
- name: Upload to the Heroku build source

View File

@@ -217,11 +217,18 @@ jobs:
const Heroku = require('heroku-client')
const heroku = new Heroku({ token: process.env.HEROKU_API_TOKEN })
const { source_blob: sourceBlob } = await heroku.post('/sources')
const { put_url: uploadUrl, get_url: downloadUrl } = sourceBlob
try {
const { source_blob: sourceBlob } = await heroku.post('/sources')
const { put_url: uploadUrl, get_url: downloadUrl } = sourceBlob
core.setOutput('upload_url', uploadUrl)
core.setOutput('download_url', downloadUrl)
core.setOutput('upload_url', uploadUrl)
core.setOutput('download_url', downloadUrl)
} catch (error) {
if (error.statusCode === 503) {
console.error('💀 Heroku may be down! Please check its Status page: https://status.heroku.com/')
}
throw error
}
# See: https://devcenter.heroku.com/articles/build-and-release-using-the-api#sources-endpoint
- name: Upload to the Heroku build source

View File

@@ -8,12 +8,6 @@ redirect_from:
shortTitle: Starter assignment
---
{% note %}
**Note:** The Git & {% data variables.product.company_short %} starter assignment is in beta and subject to change.
{% endnote %}
The Git & {% data variables.product.company_short %} starter assignment is a pre-made course that summarizes the basics of Git and {% data variables.product.company_short %} and links students to resources to learn more about specific topics.
## Prerequisites

View File

@@ -38,7 +38,8 @@ export default async function createApp(pullRequest) {
try {
await heroku.get(`/apps/${appName}`)
} catch (e) {
} catch (error) {
announceIfHerokuIsDown(error)
appExists = false
}
@@ -52,6 +53,7 @@ export default async function createApp(pullRequest) {
console.log('Heroku App created', newApp)
} catch (error) {
announceIfHerokuIsDown(error)
throw new Error(`Failed to create Heroku App ${appName}. Error: ${error}`)
}
@@ -68,6 +70,7 @@ export default async function createApp(pullRequest) {
console.log(`Added PR author @${author.login} as a Heroku app collaborator`)
}
} catch (error) {
announceIfHerokuIsDown(error)
// It's fine if this fails, it shouldn't block the app from deploying!
console.warn(`Warning: failed to add PR author as a Heroku app collaborator. Error: ${error}`)
}
@@ -82,8 +85,15 @@ export default async function createApp(pullRequest) {
body: appConfigVars,
})
} catch (error) {
announceIfHerokuIsDown(error)
throw new Error(`Failed to update Heroku app configuration variables. Error: ${error}`)
}
return appName
}
function announceIfHerokuIsDown(error) {
if (error && error.statusCode === 503) {
console.error('💀 Heroku may be down! Please check its Status page: https://status.heroku.com/')
}
}

View File

@@ -143,6 +143,7 @@ export default async function deployToProduction({
body: appConfigVars,
})
} catch (error) {
announceIfHerokuIsDown(error)
throw new Error(`Failed to update Heroku app configuration variables. Error: ${error}`)
}
@@ -158,6 +159,7 @@ export default async function deployToProduction({
},
})
} catch (error) {
announceIfHerokuIsDown(error)
throw new Error(`Failed to create Heroku build. Error: ${error}`)
}
@@ -183,6 +185,7 @@ export default async function deployToProduction({
continue
}
}
announceIfHerokuIsDown(error)
throw new Error(`Failed to get build status. Error: ${error}`)
}
@@ -235,6 +238,7 @@ export default async function deployToProduction({
continue
}
}
announceIfHerokuIsDown(error)
throw new Error(`Failed to get release status. Error: ${error}`)
}
@@ -293,6 +297,7 @@ export default async function deployToProduction({
continue
}
}
announceIfHerokuIsDown(error)
throw new Error(`Failed to find dynos for this release. Error: ${error}`)
}
}
@@ -323,6 +328,7 @@ export default async function deployToProduction({
`Here are the last ${HEROKU_LOG_LINES_TO_SHOW} lines of the Heroku log:\n\n${logText}`
)
} catch (error) {
announceIfHerokuIsDown(error)
// Don't fail because of this error
console.error(`Failed to retrieve the Heroku logs for the crashed dynos. Error: ${error}`)
}
@@ -429,3 +435,9 @@ async function getTarballUrl({ octokit, owner, repo, sha }) {
})
return tarballUrl
}
function announceIfHerokuIsDown(error) {
if (error && error.statusCode === 503) {
console.error('💀 Heroku may be down! Please check its Status page: https://status.heroku.com/')
}
}

View File

@@ -137,6 +137,7 @@ export default async function deployToStaging({
try {
await heroku.get(`/apps/${appName}`)
} catch (error) {
announceIfHerokuIsDown(error)
appExists = false
}
@@ -150,6 +151,7 @@ export default async function deployToStaging({
console.log(`Heroku app '${appName}' deleted for forced rebuild`)
} catch (error) {
announceIfHerokuIsDown(error)
throw new Error(
`Failed to delete Heroku app '${appName}' for forced rebuild. Error: ${error}`
)
@@ -201,6 +203,7 @@ export default async function deployToStaging({
// This probably will not be available yet
build = appSetup.build
} catch (error) {
announceIfHerokuIsDown(error)
throw new Error(`Failed to create Heroku app '${appName}'. Error: ${error}`)
}
@@ -217,6 +220,7 @@ export default async function deployToStaging({
console.log(`Added PR author @${author.login} as a Heroku app collaborator`)
}
} catch (error) {
announceIfHerokuIsDown(error)
// It's fine if this fails, it shouldn't block the app from deploying!
console.warn(
`Warning: failed to add PR author as a Heroku app collaborator. Error: ${error}`
@@ -239,6 +243,7 @@ export default async function deployToStaging({
continue
}
}
announceIfHerokuIsDown(error)
throw new Error(`Failed to get AppSetup status. Error: ${error}`)
}
@@ -278,6 +283,7 @@ See Heroku logs for more information:\n${logUrl}`
body: appConfigVars,
})
} catch (error) {
announceIfHerokuIsDown(error)
throw new Error(`Failed to update Heroku app configuration variables. Error: ${error}`)
}
@@ -293,6 +299,7 @@ See Heroku logs for more information:\n${logUrl}`
},
})
} catch (error) {
announceIfHerokuIsDown(error)
throw new Error(`Failed to create Heroku build. Error: ${error}`)
}
@@ -319,6 +326,7 @@ See Heroku logs for more information:\n${logUrl}`
continue
}
}
announceIfHerokuIsDown(error)
throw new Error(`Failed to get build status. Error: ${error}`)
}
@@ -371,6 +379,7 @@ See Heroku logs for more information:\n${logUrl}`
continue
}
}
announceIfHerokuIsDown(error)
throw new Error(`Failed to get release status. Error: ${error}`)
}
@@ -437,6 +446,7 @@ See Heroku logs for more information:\n${logUrl}`
try {
nextRelease = await heroku.get(`/apps/${appName}/releases/${release.version + 1}`)
} catch (error) {
announceIfHerokuIsDown(error)
throw new Error(
`Could not find a secondary release to explain the disappearing dynos. Error: ${error}`
)
@@ -475,6 +485,7 @@ See Heroku logs for more information:\n${logUrl}`
continue
}
}
announceIfHerokuIsDown(error)
throw new Error(`Failed to find dynos for this release. Error: ${error}`)
}
}
@@ -505,6 +516,7 @@ See Heroku logs for more information:\n${logUrl}`
`Here are the last ${HEROKU_LOG_LINES_TO_SHOW} lines of the Heroku log:\n\n${logText}`
)
} catch (error) {
announceIfHerokuIsDown(error)
// Don't fail because of this error
console.error(`Failed to retrieve the Heroku logs for the crashed dynos. Error: ${error}`)
}
@@ -632,3 +644,9 @@ async function getTarballUrl({ octokit, owner, repo, sha }) {
})
return tarballUrl
}
function announceIfHerokuIsDown(error) {
if (error && error.statusCode === 503) {
console.error('💀 Heroku may be down! Please check its Status page: https://status.heroku.com/')
}
}

View File

@@ -42,6 +42,7 @@ export default async function undeployFromStaging({
try {
await heroku.get(`/apps/${appName}`)
} catch (error) {
announceIfHerokuIsDown(error)
appExists = false
}
@@ -52,6 +53,7 @@ export default async function undeployFromStaging({
console.log(`Heroku app '${appName}' deleted`)
} catch (error) {
announceIfHerokuIsDown(error)
throw new Error(`Failed to delete Heroku app '${appName}'. Error: ${error}`)
}
}
@@ -127,3 +129,9 @@ export default async function undeployFromStaging({
throw error
}
}
function announceIfHerokuIsDown(error) {
if (error && error.statusCode === 503) {
console.error('💀 Heroku may be down! Please check its Status page: https://status.heroku.com/')
}
}