-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| } |