mirror of
https://github.com/actions/configure-pages.git
synced 2026-03-30 18:14:51 +00:00
Add prettier configuration
This commit is contained in:
@@ -2,26 +2,27 @@ const core = require('@actions/core')
|
||||
const axios = require('axios')
|
||||
const setPagesPath = require('./set-pages-path')
|
||||
|
||||
async function getPagesBaseUrl({ repositoryNwo, githubToken, staticSiteGenerator}) {
|
||||
async function getPagesBaseUrl({
|
||||
repositoryNwo,
|
||||
githubToken,
|
||||
staticSiteGenerator
|
||||
}) {
|
||||
try {
|
||||
const pagesEndpoint = `https://api.github.com/repos/${repositoryNwo}/pages`
|
||||
|
||||
core.info(`Get the Base URL to the page with endpoint ${pagesEndpoint}`)
|
||||
const response = await axios.get(
|
||||
pagesEndpoint,
|
||||
{
|
||||
headers: {
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
Authorization: `Bearer ${githubToken}`
|
||||
}
|
||||
const response = await axios.get(pagesEndpoint, {
|
||||
headers: {
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
Authorization: `Bearer ${githubToken}`
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
pageObject = response.data
|
||||
core.info(JSON.stringify(pageObject))
|
||||
|
||||
const siteUrl = new URL(pageObject.html_url)
|
||||
if ( staticSiteGenerator ) {
|
||||
if (staticSiteGenerator) {
|
||||
setPagesPath({staticSiteGenerator, path: siteUrl.pathname})
|
||||
}
|
||||
core.setOutput('base_url', siteUrl.href)
|
||||
|
||||
Reference in New Issue
Block a user