GithubHelp home page GithubHelp logo

Adding label to PR about action HOT 6 CLOSED

changesets avatar changesets commented on July 27, 2024
Adding label to PR

from action.

Comments (6)

Andarist avatar Andarist commented on July 27, 2024

Seems like this might be highly specific to a particular project - you could automate this using other github actions or by creating a dedicated probot app for this.

from action.

williamboman-pp avatar williamboman-pp commented on July 27, 2024

Hmm I see. Do you mean something like https://github.com/actions/labeler? Personally I don't feel like wanting to have labels on Changeset PRs is an uncommon use case, I think it'd be nice to have "all batteries included".

But seeing how easy it is to compose actions, maybe that's a better approach.

from action.

denieler avatar denieler commented on July 27, 2024

we used actions/github-script@v4 action for this, works pretty fine and easy to setup:

- name: Add label to "Version Package" PR
   uses: actions/github-script@v4
   with:
     github-token: ${{secrets.GITHUB_TOKEN}}
     script: |
       // Get list of all open PRs with
       // head branch "changeset-release/master"
       // (there should be max 1 PR with such condition)
       const { data } = await github.pulls.list({
         owner: 'owner',
         repo: 'repoName',
         state: 'open',
         head: `{repoName}:changeset-release/master`
       })

       for await (let pr of data) {
         github.issues.addLabels({
           owner: 'owner',
           repo: 'repoName',
           issue_number: pr.number,
             labels: [
               'some-label'
             ]
         })
       }

from action.

BeeeQueue avatar BeeeQueue commented on July 27, 2024

Alternatively you could also use the GitHub CLI which is available in all actions:

jobs:
  label:
    name: Adds labels to PRs
    steps:
      - run: gh pr edit --add-label "label name" "$PR_URL"
        env:
          PR_URL: ${{github.event.pull_request.html_url}}
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} # Not sure if this one is required

from action.

Andarist avatar Andarist commented on July 27, 2024

Alternatively you could also use the GitHub CLI which is available in all actions:

TIL, nice!

With that in place - it really feels like something that can be handled externally. We could use a "recipe" for this in the README though if anyone wants to prepare one.

from action.

quantizor avatar quantizor commented on July 27, 2024

I have a use case where it would be helpful if this was just part of the changesets action.

Specifically I'd like to add an "automerge" label if the changeset only contains patch changes. Would use it like this:

- name: Check for Patch Changes
  id: check_patch
  run: |
    if yarn changeset status | grep -q "info Packages to be bumped at patch"; then
      echo "::set-output name=label::automerge"
    else
      echo "::set-output name=label::"
    fi

- name: create or publish changeset
  id: create-or-publish-changeset
  uses: changesets/action@v1
  env:
    GITHUB_TOKEN: [redacted]
  with:
    commit: "chore: update package version"
    label: ${{steps.check_patch.outputs.label}}
    publish: "yarn release"
    setupGitUser: false
    title: "chore: update package version"

from action.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.