|
I would like pr-preview to run only if a specific label is added to a PR. However listening to labeled events, causes pr-preview to skip executing together with Adding a label to the PR results in: |
Replies: 2 comments
|
Moved from issues to discussion as this is about debugging a setup rather than a feature request. See the documentation on the
You need to set the - name: Create Preview
uses: rossjrw/pr-preview-action@v1
if: contains(github.event.pull_request.labels.*.name, 'pr-preview')
with:
action: ${{ github.event.action == "closed" && 'remove' || 'deploy' }}Or, you might want to remove the preview if the label is removed: - name: Create Preview
uses: rossjrw/pr-preview-action@v1
with:
action: >-
${{
github.event_name == "pull_request"
&& github.event.action != "closed"
&& contains(github.event.pull_request.labels.*.name, 'pr-preview')
&& 'deploy' || 'remove'
}}Should the action run on labeled events anyway? I don't think so - labelling is generally a no-op action, I wouldn't generally expect adding/removing a label to do anything, outside of specific configurations like yours. Even then, there's no way for this action to know ahead of time specifically which label to look for, or any custom behaviour you need. |
|
Ok, I see it's expected behavior because of the and |
Ok, I see it's expected behavior because of the
action: auto. Removed it and separated in two steps to always run the cleanup when PR is closed:and