-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
00dcaeb
commit 3a1ee62
Showing
2 changed files
with
121 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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { a as coreExports, b as getOctokit_1, e as context } from './github-b307e6bd.mjs'; | ||
import 'os'; | ||
import 'fs'; | ||
import 'path'; | ||
import 'http'; | ||
import 'https'; | ||
import 'net'; | ||
import 'tls'; | ||
import 'events'; | ||
import 'assert'; | ||
import 'util'; | ||
import 'module'; | ||
import 'stream'; | ||
import 'buffer'; | ||
import 'querystring'; | ||
import 'stream/web'; | ||
import 'node:stream'; | ||
import 'node:util'; | ||
import 'node:events'; | ||
import 'worker_threads'; | ||
import 'perf_hooks'; | ||
import 'util/types'; | ||
import 'async_hooks'; | ||
import 'console'; | ||
import 'url'; | ||
import 'zlib'; | ||
import 'string_decoder'; | ||
import 'diagnostics_channel'; | ||
|
||
async function run() { | ||
const token = coreExports.getInput("github-token"); | ||
const octokit = getOctokit_1(token); | ||
const { eventName, repo, runId } = context; | ||
console.log(context); | ||
console.log(process.env); | ||
console.log({ | ||
owner: repo.owner, | ||
repo: repo.repo, | ||
run_id: runId | ||
}); | ||
console.log("Event:", eventName); | ||
if (eventName !== "push") { | ||
return; | ||
} | ||
const jobInfo = await octokit.rest.actions.listJobsForWorkflowRun({ | ||
owner: repo.owner, | ||
repo: repo.repo, | ||
run_id: runId | ||
}); | ||
console.log("Jobs:", jobInfo.data.jobs); | ||
const job = jobInfo.data.jobs.find((job2) => job2.name === process.env.GITHUB_JOB); | ||
console.log("Job:", job); | ||
if (!job) { | ||
return; | ||
} | ||
console.log("Job ID:", job.id); | ||
console.log("Job URL:", job.html_url); | ||
console.log("Job Status:", job.status); | ||
} | ||
run().catch((error) => { | ||
if ("message" in error) { | ||
coreExports.setFailed(error.message); | ||
} else { | ||
coreExports.setFailed("Unknown error: " + JSON.stringify(error)); | ||
} | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import * as core from '@actions/core' | ||
import * as github from '@actions/github' | ||
|
||
import path from 'node:path' | ||
import resolve from 'resolve-package-path' | ||
import { execa } from 'execa' | ||
|
||
const UNIQUE_IDENTIFIER = '<!-- @astrojs/action-studio -->'; | ||
|
||
async function run(): Promise<void> { | ||
const token = core.getInput('github-token') | ||
const octokit = github.getOctokit(token) | ||
const { eventName, repo, runId } = github.context; | ||
console.log(github.context); | ||
console.log(process.env); | ||
console.log({ | ||
owner: repo.owner, | ||
repo: repo.repo, | ||
run_id: runId | ||
}); | ||
|
||
// On push to any branch defined in `on: ...`, run `astro db push` | ||
console.log('Event:', eventName); | ||
|
||
if (eventName !== 'push') { | ||
return; | ||
} | ||
|
||
const jobInfo = await octokit.rest.actions.listJobsForWorkflowRun({ | ||
owner: repo.owner, | ||
repo: repo.repo, | ||
run_id: runId | ||
}); | ||
console.log('Jobs:', jobInfo.data.jobs); | ||
const job = jobInfo.data.jobs.find(job => job.name === process.env.GITHUB_JOB); | ||
console.log('Job:', job); | ||
if (!job) { | ||
return; | ||
} | ||
console.log('Job ID:', job.id); | ||
console.log('Job URL:', job.html_url); | ||
console.log('Job Status:', job.status); | ||
|
||
// Notify Astro Studio that this has just begin | ||
// | ||
} | ||
|
||
|
||
run().catch((error) => { | ||
if ('message' in error) { | ||
core.setFailed(error.message) | ||
} else { | ||
core.setFailed('Unknown error: ' + JSON.stringify(error)) | ||
} | ||
}); |