labeler
labeler copied to clipboard
Could not get pull request number from context, exiting
Similar to #25 I am getting the error "Could not get pull request number from context, exiting"
I tried playing around with a variety of things but could not get it to run.
.github/labeler.yml:
# Add 'github' label to any change within the '.github' folder
github:
- .github/*
- .github/**/*
test:
- lib/tests/*
- lib/tests/**/*
- multiview/src/test/*
- multiview/src/test/*
.github/workflows/push.yml
on: push
name: On Push Workflow
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
Also tried with a repo specific token. v2.1.0, and combining with another workflow - no results.
I'm having the same issue here.
.github/labeler.yml
'Status: Review Needed':
- docs/**/*
'Type: Content':
- docs/**/*.md
'Type: Design':
- docs/**/*.styl
'Type: Documentation':
- README.md
'Type: Tooling':
- .github/**/*
'Type: Dependencies':
- package.json
'Type: Translation':
- docs/translations/**/*
- docs/.vuepress/theme/utils/translations.js
.github/workflows/labeler.yml
name: Labeler
on:
schedule:
- cron: '0 * * * *'
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v2
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
It looks to be coming from this line: https://github.com/actions/labeler/blob/4b52aec09ba832eb9aecccddbccce644ba9ba69d/src/main.ts#L20
In my case, I suspect the cronjob approach is causing the failure, because the action does not have the github.context.payload.pull_request
needed in getPrNumber()
.
I believe this error is related to run the pipeline on a branch and not PR: https://github.com/actions/labeler/blob/4b52aec09ba832eb9aecccddbccce644ba9ba69d/src/main.ts#L50
I got the same error. To fix I added to trigger this info:
on: pull_request: types: [ opened, synchronize, reopened ]
Hello everyone! This issue has been open for a year without any activity, so I'm going to close it as stale. Please feel free to contact us if the issue is still relevant to you and we will reopen it. Thanks!