How would I check for a label added on a pull request when I merge to main branch from a pull request. I tried using the below but didn't work:
name: Publish
on:
push:
branches:
- main
jobs:
Publish:
runs-on: ubuntu-latest
steps:
if: ${{github.event.label.name == 'release'}}
.......
CodePudding user response:
How about like this?
name: Create Release
on:
pull_request:
branches:
- main
types:
- closed
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') # detect when pull request is merged since there's no merged event.
steps:
- name: Create release
...