Skip to content

Commit

Permalink
feat: use dependabot/fetch-metadata action (#276)
Browse files Browse the repository at this point in the history
* wip

* feat: use fetch-metadata action instead of parsing PR

* fix: improve APPROVE_ONLY log message

* chore: remove payload.json

* fix: fix githubClient initialization

* fix: use github-script's  github client

* test: fix github-client tests

* fix: fix script typo

* fix: more fixes to script typos

* fix: only run actions when actor is dependabot

* fix: remove token from github-client tests
  • Loading branch information
guilhermelimak committed Oct 3, 2022
1 parent 4f799a7 commit 46e2239
Show file tree
Hide file tree
Showing 17 changed files with 826 additions and 9,797 deletions.
28 changes: 26 additions & 2 deletions action.yml
@@ -1,5 +1,6 @@
name: 'Github Action Merge Dependabot'
description: 'Automatically approve and merge dependabot PRs'

inputs:
github-token:
description: 'A GitHub token'
Expand Down Expand Up @@ -27,9 +28,32 @@ inputs:
pr-number:
description: 'A pull request number, only required if triggered from a workflow_dispatch event'
required: false

runs:
using: 'node16'
main: 'dist/index.js'
using: 'composite'
steps:
- name: Fetch metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1
if: ${{ github.actor == 'dependabot[bot]' }}
- name: Merge/approve PR
uses: actions/github-script@v6
if: ${{ github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' }}
with:
github-token: ${{ inputs.github-token }}
script: |
const script = require('${{ github.action_path }}/dist/index.js')
await script({
github,
context,
inputs: ${{ toJSON(inputs) }},
dependabotMetadata: {
updateType: '${{ steps.dependabot-metadata.outputs.update-type }}',
dependencyType:'${{ steps.dependabot-metadata.outputs.dependency-type }}',
dependencyNames: '${{ steps.dependabot-metadata.outputs.dependency-names }}',
}
})
branding:
icon: 'git-pull-request'
color: 'gray-dark'
315 changes: 0 additions & 315 deletions dist/105.index.js

This file was deleted.

0 comments on commit 46e2239

Please sign in to comment.