Comments (4)
from pr-labels-action.
@joerick for example
I create PR - 1
with label minor
, when trigger github action on this PR - 1
, joerick/[email protected]
will return the correct label minor
. Everything works fine.
But when I merge this PR - 1
to default branch (main
in this case), and I have the workflow trigger push event on main
, joerick/[email protected]
won't return the label from merged PR - 1
(only show Not a pull request
)
This is not a bug. Just a request to support another case, that joerick/[email protected]
can return the correct label from merged PR - 1
(minor
in this case) when pushing PR - 1
to default branch.
from pr-labels-action.
@victornvg I too was wanting to do this, but I don't think it's easily done using the REST API. A push is a commit, so the payload when using the REST API has no information related to the PR. It's distinctly possible I have no idea what I'm talking about, but you can read about commits (pushes) here --> https://docs.github.com/en/rest/reference/commits#get-a-commit There is an example of the returned payload and you can see there is no information related to the PR. A PR requires a push, but a push doesn't require a PR, so it makes some intuitive sense.
It looks like you might be able to work backwards to the PR using the commit's ref. I don't know how difficult that would be, but it seems mildly convoluted to me. Again, it's distinctly possible I have no idea what I'm talking about.
That said, it looks like the GraphQL API makes this easier. One of the fields in the commit object is associatedPullRequests. You can see that here --> https://docs.github.com/en/graphql/reference/objects#commit If you poke around a bit in the GraphQL API documentation, you'll see there is a labels field associated with the PullRequest object.
from pr-labels-action.
I suspect you can accomplish what you are looking for by matching on a pull request of type closed that has been merged.
For example, this on
block:
on:
pull_request:
types:
- closed
branches:
- main
And in each job, make sure you match on pull requests that have been merged (because you probably won't want to match pull requests that have been closed without merging):
if: github.event.pull_request.merged == true
See this for more information: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-pull_request-workflow-when-a-pull-request-merges
from pr-labels-action.
Related Issues (8)
- Warning about deprecate `set-output` command still visible in `v1.0.8` HOT 2
- Warning: The `set-output` command is deprecated and will be disabled soon.
- Mark v1.0.9 as latest release HOT 1
- Update to node 20
- Error message: Not a pull request HOT 2
- Labels not available when creating PR
- Warning about deprecated `set-output` command HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pr-labels-action.