bobheadxi / deployments

🔖 GitHub Action for working painlessly with deployment statuses
https://github.com/marketplace/actions/github-deployments
MIT License
385 stars 64 forks source link

consider support for 'pull_request' event (instead of just 'push') #5

Closed rlataguerra closed 4 years ago

rlataguerra commented 4 years ago

Deployments are shown on the https://github.com/xx/yy/deployments page but not on the pull request page.

Capture d’écran 2020-02-09 à 18 52 37 Capture d’écran 2020-02-09 à 18 52 23
bobheadxi commented 4 years ago

Can you post your workflow configuration? Also maybe take a look at the discussion in #4 regarding configuration

rlataguerra commented 4 years ago

As it is explained in #4 I guess my problem comes from using the pull_request event :/ No workaround beside using push ?

bobheadxi commented 4 years ago

Not at the moment, mostly for my reason outlined here:

looks like the event pull_request only procs on 3 conditions:

Note: By default, a workflow only runs when a pull_request's activity type is opened, synchronize, or reopened. To trigger workflows for more activity types, use the types keyword.

This is pretty unlikely to be what you actually want, since you won't be able to update your deployment on subsequent pushes to your pull request. I would advise just switching to push, and add the branches you want to deploy for your pull request by hand as we do

I'm open to input however! (ie is there a use case you have that requires pull_request and PR deployment status integration?)

xt0rted commented 4 years ago

I published an action earlier for a different type of workflow but it might be usable with the pull_request event too. https://github.com/xt0rted/pull-request-comment-branch

What this does is checks the current event's issue to see if it's a PR or not, if so it gets the head ref and sha for the PR branch.

When run on a pull_request event this should run through and get the branch info. As long as it does you can then use that on the actions/checkout step to get the right branch.

I'm not sure if the context from @actions/github will have the correct ref loaded, but it's worth a quick test to see. This action won't work with the push event so you'd have to remove that for now or use an if check to only run this on pull_request events.

bobheadxi commented 4 years ago

Closed by #9, support for pull_request via ref: ${{ github.head_ref }} is now available in https://github.com/bobheadxi/deployments/releases/tag/v0.4.0! Thanks @codyleblanc