Monorepo for Tangled tangled.org

feature: TriggerKindPullRequestClosed #696

Open wilb.me
Open opened by wilb.me

Hi there, I was looking into what would be needed to set up preview deploys through tangled pipelines. The main thing that appears to be missing is a teardown trigger for when a PR is closed. From what I can tell there exists a "pull_request:closed" webhook event type, but workflows only have the triggers "push", "pullRequest" and "manual".

Would love to take this feature on if you guys support it!

teardown trigger? you can use /xrpc/sh.tangled.ci.cancelPipeline and that should destroy it

I'm referring to a teardown of a preview deployment on PR close, not to cancel the pipeline.

ah gotcha, sorry, misunderstood

No worries! Would love to hear your opinion on this feature. Maybe I could do a clearer job explaining it.

im probably thinking we can have pull_request_closed and pull_request_merged then. spindle will just have to listen to pr status also. makes sense to support these i think

ngl im not a fan of nesting but i guess its cleaner?

It also leaves some space for passing custom event-matching fields. Good example from GA docs:

# For example, this workflow will run when someone opens a pull request that targets a branch whose name starts with `releases/`:
on:
  pull_request:
    types:
      - opened
    branches:
      - 'releases/**'

oh yeah fair enough i forgot those exist... tbh im curious because the branches arent necessarily a property of the pull_request itself. i wonder if we just combine these filters together instead. something like:

on:
  - event: push
  - event: pull_request
    where:
      branches:
        - releases/**

where 'where' is generic. you should also be able to put multiple events in event: like event: [pull_request_closed, pull_request_merged]?

I think branches is the part of pull_request and not a global property here. It will mean nothing for events like issues.

mmm fair yeah... i guess it is unavoidable then

I like the idea of sub-event types! Chose to suggest the smallest possible change 😃

I suppose the filter would have to default to the current behavior, to avoid existing pipelines triggering on PR close if not specified.

Sign up or Sign in to add to the discussion.