Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Smitha Borkar authored and GitHub committed Jun 7, 2022
1 parent 279f89f commit 43f9924
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
const core = require('@actions/core')
const axios = require('axios')



async function getPageBaseUrl(evtOrExitCodeOrError) {
try {
if (deployment.requestedDeployment) {
const pagesEndpoint = `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages`
const response = await axios.get(
pagesEndpoint,
{},
{
headers: {
Accept: 'application/vnd.github.v3+json',
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`,
'Content-type': 'application/json'
}
}
)

pageObject = response.data
core.info(JSON.stringify(pageObject))
core.setOutput('base_url', pageObject.html_url)
core.info(`Get the Base URL to the page with endpoint ${pagesEndpoint}`)
}
} catch (e) {
console.info('Get on the Page failed', e)
}
process.exit(isNaN(+evtOrExitCodeOrError) ? 1 : +evtOrExitCodeOrError)
}

0 comments on commit 43f9924

Please sign in to comment.