Skip to content

Commit

Permalink
Basic ping test
Browse files Browse the repository at this point in the history
  • Loading branch information
dsarfati committed Apr 16, 2024
1 parent 16006ac commit cc54a1d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ jobs:
salad_organization: salad
salad_project: development
salad_container_group: test-actions
salad_api_key: ${{secrets.SALAD_API_KEY}}
image_name: coryrieth/beepfast:long
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,36 @@ export async function run(): Promise<void> {
const org = core.getInput('salad_organization')
const proj = core.getInput('salad_project')
const containerGroup = core.getInput('salad_container_group')
const apiKey = core.getInput('salad_api_key')

core.warning(`Org: ${org}`)
core.warning(`Project: ${proj}`)
core.warning(`ContainerGroup: ${containerGroup}`)

core.warning(`Making request`)
// https.request()

const response = await fetch(
`https://api.salad.com/api/public/organizations/${org}/projects/${proj}/containers/${containerGroup}`,
{
method: 'GET', // *GET, POST, PUT, DELETE, etc.
headers: {
'Content-Type': 'application/json',
'Salad-Api-Key': apiKey
}
}
)

if (!response.ok) {
// TODO: Log issue
}

core.warning(response.status.toString())

const body = await response.json()

core.warning(body)

// const ms: string = core.getInput('milliseconds')

// // Debug logs are only output if the `ACTIONS_STEP_DEBUG` secret is true
Expand All @@ -27,6 +53,7 @@ export async function run(): Promise<void> {
// // Set outputs for other workflow steps to use
// core.setOutput('time', new Date().toTimeString())
} catch (error) {
core.error(JSON.stringify(error))
// Fail the workflow run if an error occurs
if (error instanceof Error) core.setFailed(error.message)
}
Expand Down

0 comments on commit cc54a1d

Please sign in to comment.