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 7ef9360
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 12 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
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 21 additions & 7 deletions dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

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.

28 changes: 28 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,8 @@ export async function run(): Promise<void> {
// // Set outputs for other workflow steps to use
// core.setOutput('time', new Date().toTimeString())
} catch (error) {
core.warning('Had an 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 7ef9360

Please sign in to comment.