Improve documentation #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request_target: | |
types: | |
- opened | |
- reopened | |
name: Label PRs with `patch` by default | |
jobs: | |
get-labels: | |
name: Get PR labels | |
runs-on: ubuntu-latest | |
if: > | |
! startsWith(github.event.pull_request.head.ref, 'release/') | |
outputs: | |
labels: ${{ steps.get-labels.outputs.labels }} | |
steps: | |
- name: Get PR labels from GitHub API | |
id: get-labels | |
env: | |
REPO: ${{ github.repository }} | |
NUMBER: ${{ github.event.pull_request.number }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
LABELS=$(gh api "repos/$REPO/issues/$NUMBER/labels") | |
echo "PR #$NUMBER is labeled with: $LABELS" | |
echo "labels=$LABELS" >> "$GITHUB_OUTPUT" | |
label: | |
name: Label PR with `patch` | |
needs: | |
- get-labels | |
if: > | |
! ( contains(fromJSON(needs.get-labels.outputs.labels).*.name, 'release') | |
|| contains(fromJSON(needs.get-labels.outputs.labels).*.name, 'minor') | |
|| contains(fromJSON(needs.get-labels.outputs.labels).*.name, 'major') | |
) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Label PR with `patch` | |
uses: actions/labeler@v4 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} |