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 7368445 commit 8202494
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,23 @@ const axios = require('axios')

async function getPageBaseUrl() {
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'
}
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}`)
}
}
)

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(1)
Expand Down

0 comments on commit 8202494

Please sign in to comment.