Skip to content

Commit

Permalink
Add refName to GitHub connection info and streamline workflow investi…
Browse files Browse the repository at this point in the history
…gation logic
  • Loading branch information
pelikhan committed Sep 27, 2024
1 parent 04a5c17 commit b463343
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 10 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/genai-investigator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ permissions:
actions: read
pull-requests: write
jobs:
logging:
runs-on: ubuntu-latest
steps:
- name: Print workflow_run event
run: echo "${{ toJson(github.event.workflow_run) }}"
check_failure:
investigate:
# Only run this job if the workflow run concluded with a failure
# and was triggered by a pull request event
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event == 'pull_request' }}
Expand Down
2 changes: 2 additions & 0 deletions docs/genaisrc/genaiscript.d.ts

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

2 changes: 2 additions & 0 deletions genaisrc/genaiscript.d.ts

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

2 changes: 2 additions & 0 deletions packages/auto/genaiscript.d.ts

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

2 changes: 2 additions & 0 deletions packages/core/src/genaisrc/genaiscript.d.ts

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

7 changes: 7 additions & 0 deletions packages/core/src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface GithubConnectionInfo {
owner: string
repo: string
ref?: string
refName?: string
sha?: string
issue?: number
runId?: string
Expand All @@ -31,6 +32,7 @@ function githubFromEnv(env: Record<string, string>): GithubConnectionInfo {
const repository = env.GITHUB_REPOSITORY
const [owner, repo] = repository?.split("/", 2) || [undefined, undefined]
const ref = env.GITHUB_REF
const refName = env.GITHUB_REF_NAME
const sha = env.GITHUB_SHA
const commitSha = env.GITHUB_COMMIT_SHA
const runId = env.GITHUB_RUN_ID
Expand All @@ -51,6 +53,7 @@ function githubFromEnv(env: Record<string, string>): GithubConnectionInfo {
owner,
repo,
ref,
refName,
sha,
issue,
runId,
Expand Down Expand Up @@ -439,12 +442,16 @@ export class GitHubClient implements GitHub {
token: auth,
repo,
owner,
ref,
refName,
} = await this.connection()
return Object.freeze({
baseUrl,
repo,
owner,
auth,
ref,
refName,
})
}

Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/types/prompt_template.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,8 @@ interface GitHubOptions {
repo: string
baseUrl?: string
auth?: string
ref?: string
refName?: string
}

type GitHubWorkflowRunStatus =
Expand Down
2 changes: 2 additions & 0 deletions packages/sample/genaisrc/blog/genaiscript.d.ts

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

6 changes: 2 additions & 4 deletions packages/sample/genaisrc/gai.genai.mts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ if (!workflow) {

const ffid = env.vars.failure_run_id
const lsid = env.vars.success_run_id
const { owner, repo } = await github.info()
const { owner, repo, refName } = await github.info()

let branch =
env.vars.branch ||
(await host.exec("git branch --show-current")).stdout.trim()
let branch = env.vars.branch || refName
if (!branch) {
const branches = await github.listBranches()
branch = await host.select("Select a branch", branches)
Expand Down
2 changes: 2 additions & 0 deletions packages/sample/genaisrc/genaiscript.d.ts

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

2 changes: 2 additions & 0 deletions packages/sample/genaisrc/node/genaiscript.d.ts

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

2 changes: 2 additions & 0 deletions packages/sample/genaisrc/python/genaiscript.d.ts

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

2 changes: 2 additions & 0 deletions packages/sample/genaisrc/style/genaiscript.d.ts

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

2 changes: 2 additions & 0 deletions packages/sample/src/aici/genaiscript.d.ts

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

2 changes: 2 additions & 0 deletions packages/sample/src/errors/genaiscript.d.ts

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

2 changes: 2 additions & 0 deletions packages/sample/src/genaiscript.d.ts

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

2 changes: 2 additions & 0 deletions packages/sample/src/makecode/genaiscript.d.ts

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

2 changes: 2 additions & 0 deletions packages/sample/src/tla/genaiscript.d.ts

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

2 changes: 2 additions & 0 deletions packages/sample/src/vision/genaiscript.d.ts

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

2 changes: 2 additions & 0 deletions packages/vscode/genaisrc/genaiscript.d.ts

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

2 changes: 2 additions & 0 deletions slides/genaisrc/genaiscript.d.ts

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

0 comments on commit b463343

Please sign in to comment.