fetch-metadata
fetch-metadata copied to clipboard
`fetch-metadata` can not fetch metadata when using `workflow_run` event
Errror
I'm using mono-repository for the microservices:
- Dependabot opens PR for Microservice 1 (Ex: path: /src/microservices-1/*)
- The workflow
CI for Microservice 1
is triggered. - The workflow
Dependabot
is triggered afterCI for Microservice 1
passed - The workflow
Dependabot
shows error.
It says:
Warning: Event payload missing `pull_request` key. Make sure you're triggering this action on the `pull_request` or `pull_request_target` events.
Error: PR is not from Dependabot, nothing to do.
Expect
The workflow Dependabot
can fetch metadata in this case.
My workflow
name: Dependabot
on:
workflow_run:
workflows:
- CI for Microservice 1
- CI for Microservice 2
types:
- completed
permissions:
contents: write
pull-requests: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: |-
github.actor == 'dependabot[bot]' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-approve non-major updates
if: steps.metadata.outputs.update-type != 'version-update:semver-major'
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Enable auto-merge non-major updates
if: steps.metadata.outputs.update-type != 'version-update:semver-major'
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
I just created this bug: https://github.com/dependabot/fetch-metadata/issues/498
but I realize now that my issue is the same as yours. Did you find any workaround?
I'm also struggling with this issue. Any workarounds?