Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetch-metadata can not fetch metadata when using workflow_run event #490

Open
kimnh-0823 opened this issue Feb 2, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@kimnh-0823
Copy link

kimnh-0823 commented Feb 2, 2024

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 after CI for Microservice 1 passed
  • The workflow Dependabot shows error.

image

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}}
@GersonTf
Copy link

GersonTf commented Mar 4, 2024

I just created this bug: #498

but I realize now that my issue is the same as yours. Did you find any workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants