Skip to content

Get Labels on Push

Actions
This action will convert all labels from the latest PR into a dictionary to be read by other steps in GitHub Actions pipeline
v1.0.1
Latest
By irby
Star (2)

PR Labels on Push

A Github action that extracts labels from the most recent push and makes them available to other actions. Labels are available as step outputs and environment variables that you can use in later steps in your action.

How do I use this?

Perhaps you have a test that you only want to run when PR label release:master is set. Your workflow should look like this:

jobs:
  test:
    steps:
      - name: Get PR labels
        id: pr-labels
        uses: irby/get-labels-on-push@v1.0.1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}

      # GITHUB_PR_LABEL_RELEASE_MASTER was set by pr-labels action
      - run: |
          if [ -n "$GITHUB_PR_LABEL_RELEASE_MASTER" ]; then
            echo "This is a release label!"
          fi

      # or you can use the action output.
      # For the label name, use lowercase kebab-case and surround with spaces
      - run: |
          scripts/release-major.sh
        if: contains(steps.pr-labels.outputs.labels, ' release-major ')

Code Based on the Following

I created this GitHub Action to combine the behaviors of these two different GitHub Actions. I am in great gratitude to these projects for forming the basis of this project.

Get Labels on Push is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

This action will convert all labels from the latest PR into a dictionary to be read by other steps in GitHub Actions pipeline
v1.0.1
Latest
By irby

Get Labels on Push is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.