Run action on labeled, unlabeled #91
-
Hey, what do you reckon about allowing the action to be triggered when a label gets added? I have a label that I'd like to change my env vars. Current flow
Proposed flow
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Moved to Discussion as this is a question about a setup issue rather than a problem with the action itself. (If a problem with the action is discovered as part of this discussion, please create an issue for that.) This Action can be run on any event as defined by your workflow: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows The PR event contains on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
- labeled
- unlabeled However - if you use this Action with parameter pr-preview-action/lib/determine-auto-action.sh Lines 17 to 28 in 430e3df If the Action runs on events You could do that with an jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
- previous steps in your workflow go here
# If event is labeled/unlabeled, deploy preview if PR is open
- uses: rossjrw/pr-preview-action@v1
if: contains(fromJSON('["labeled", "unlabeled"]'), github.event.pull_request.action) && github.event.pull_request.state == 'open'
with:
action: deploy
# Otherwise, let preview action decide whether to deploy/remove preview
- uses: rossjrw/pr-preview-action@v1
if: ${{ ! contains(fromJSON('["labeled", "unlabeled"]') }}
with:
action: auto Haven't tested the above, but something like it might work for you. |
Beta Was this translation helpful? Give feedback.
Moved to Discussion as this is a question about a setup issue rather than a problem with the action itself. (If a problem with the action is discovered as part of this discussion, please create an issue for that.)
This Action can be run on any event as defined by your workflow: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows
The PR event contains
labeled
andunlabeled
activity types, so you could modify your event trigger to add those:However - if you use this Action with parameter
action: auto