Skip to content

Commit

Permalink
try again
Browse files Browse the repository at this point in the history
  • Loading branch information
diracdeltas committed Apr 30, 2024
1 parent 7dd2d04 commit 6bef4de
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ runs:
- id: npm
run: cd ${{ github.action_path }}; npm ci
shell: bash
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- id: llm-and-post-message
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: ${{ !contains(github.event.pull_request.labels.*.name, 'CI/skip-llm') && !contains(github.event.pull_request.labels.*.name, 'CI/skip') && github.event.pull_request.draft == false }}
Expand All @@ -88,6 +87,7 @@ runs:
DEBUG: ${{ (inputs.debug == 'true' || runner.debug) && 'true' || 'false'}}
with:
script: |
const script = require('./action.cjs')
const actionPath = ${{ github.action_path }}
const script = require(`${actionPath}/src/action.js`)
const inputs = ${{ toJson(inputs) }}
await script({github, context, inputs})
await script({github, context, inputs, actionPath})
24 changes: 12 additions & 12 deletions action.cjs → src/action.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = async ({github, context, inputs}) => {
const { default: filterdiff } = await import('${{ github.action_path }}/src/filterdiff.js')
const { default: getConfig } = await import('${{ github.action_path }}/src/getConfig.js')
const { default: getProperties } = await import('${{ github.action_path }}/src/getProperties.js')
module.exports = async ({github, context, inputs, actionPath}) => {
const { default: filterdiff } = await import(`${actionPath}/src/filterdiff.js`)
const { default: getConfig } = await import(`${actionPath}/src/getConfig.js`)
const { default: getProperties } = await import(`${actionPath}/src/getProperties.js`)

// delete if empty string in inputs value
Object.keys(inputs).forEach(key => inputs[key] === '' && delete inputs[key])
Expand Down Expand Up @@ -35,20 +35,20 @@ module.exports = async ({github, context, inputs}) => {

const { default: explainPatch } =
options.bedrock_aws_iam_role_arn
? await import('${{ github.action_path }}/src/bedrockExplainPatch.js')
? await import(`${actionPath}/src/bedrockExplainPatch.js`)
: options.anthropic_api_key
? await import('${{ github.action_path }}/src/anthropicExplainPatch.js')
: await import('${{ github.action_path }}/src/openaiExplainPatch.js')
? await import(`${actionPath}/src/anthropicExplainPatch.js`)
: await import(`${actionPath}/src/openaiExplainPatch.js`)

const { default: submitReview } = options.subtle_mode
? await import('${{ github.action_path }}/src/subtleSubmitReview.js')
: await import('${{ github.action_path }}/src/submitReview.js')
? await import(`${actionPath}/src/subtleSubmitReview.js`)
: await import(`${actionPath}/src/submitReview.js`)

const { default: getPatch } = (context.payload.pull_request && context.payload.pull_request.user.login === 'renovate[bot]') || context.actor === 'renovate[bot]'
? await import('${{ github.action_path }}/src/getRenovatePatch.js')
? await import(`${actionPath}/src/getRenovatePatch.js`)
: (context.payload.pull_request && context.payload.pull_request.user.login === 'dependabot[bot]') || context.actor === 'dependabot[bot]'
? await import('${{ github.action_path }}/src/getDependabotPatch.js')
: await import('${{ github.action_path }}/src/getPatch.js')
? await import(`${actionPath}/src/getDependabotPatch.js`)
: await import(`${actionPath}/src/getPatch.js`)

options.key = options.anthropic_api_key || options.openai_api_key
options.models = options.bedrock_aws_iam_role_arn
Expand Down

0 comments on commit 6bef4de

Please sign in to comment.