Skip to content

Commit

Permalink
fix: 4
Browse files Browse the repository at this point in the history
  • Loading branch information
samtrion committed Dec 21, 2023
1 parent f21ffe0 commit c5555c7
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 63 deletions.
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ branding:

# Define your inputs here.
inputs:
github-token:
token:
description: 'The GitHub token used to merge the pull-request'
required: true

Expand Down Expand Up @@ -66,7 +66,7 @@ runs:
id: dependamerge
uses: actions/github-script@v7.0.1
with:
github-token: ${{ inputs.github-token }}
github-token: ${{ inputs.token }}
script: |
const script = require('${{ github.action_path }}dist/index.js')
await script({
Expand Down
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.
80 changes: 31 additions & 49 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 src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
/**
* The entrypoint for the action.
*/
const run = require('./main')
const run = require('./main').default

module.exports = run
27 changes: 17 additions & 10 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
const core = require('@actions/core')
const github = require('@actions/github')
import * as core from '@actions/core'
import * as gh from '@actions/github'

const { logInfo, logDebug, logWarning } = require('./log')
import { logInfo, logDebug, logWarning } from './log'

/**
* The main function for the action.
* @returns {Promise<void>} Resolves when the action is complete.
*/
module.exports = async function run({ _, context, inputs, metadata }) {
export default async function run({ github, context, inputs, metadata }) {
try {
logInfo('context: ', JSON.stringify(context))
logInfo('inputs: ', JSON.stringify(inputs))
logInfo('gh:')
logInfo(JSON.stringify(github))
logInfo('context:')
logInfo(JSON.stringify(context))
logInfo('inputs:')
logInfo(JSON.stringify(inputs))

if (metadata !== undefined) {
logInfo('metadata: ', JSON.stringify(metadata))
logInfo('metadata:')
logInfo(JSON.stringify(metadata))
}

// init octokit
const octokit = github.getOctokit(inputs.githubToken)
// const octokit = gh.getOctokit(inputs.token)
const pull_request = context.payload.pull_request
const repo = context.payload.repository

logInfo('pull_request: ', JSON.stringify(pull_request))
logInfo('repo: ', JSON.stringify(repo))
logInfo('pull_request:')
logInfo(JSON.stringify(pull_request))
logInfo('repo:')
logInfo(JSON.stringify(repo))
} catch (error) {
// Fail the workflow run if an error occurs
core.setFailed(error.message)
Expand Down

0 comments on commit c5555c7

Please sign in to comment.