Giter Site home page Giter Site logo

pr-labels-action's People

Contributors

alexciesielski avatar dpolyakov avatar joerick avatar mydea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pr-labels-action's Issues

Error message: Not a pull request

I have a conflicted PR with:
base: staging branch
compare: feature branch

I put the workflow on master branch.
But the steps for pr-labels-actions shows: Not a pull request

name: check-conflicts-and-notify
on:
  schedule:
    - cron: '*/5 * * * *'
jobs:
  check-conflicts:
    runs-on: self-hosted
    steps:
      - name: Label merge conflicts
        uses: eps1lon/[email protected]
        with:
          repoToken: "${{ secrets.JG_BOT_TOKEN }}"
          dirtyLabel: "conflicts"
          removeOnDirtyLabel: "automerge"
          continueOnMissingPermissions: true
      - name: Check conflicted PR
        uses: joerick/[email protected]
        id: pr-labels
      - name: Sent to Google Chat
        if: contains(steps.pr-labels.outputs.labels, ' conflicts ')
        uses: Co-qn/google-chat-notification@releases/v1
        with:
          name: Conflict Merge to Staging
          url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
          status: failure

Support getting labels when merging PR into default branch

Currently I use this github action and it work well in the PR, but when I have workflow that is triggered on push event like this
image

This error will appear.
image

Can you also support this case? getting label base on the push event to default branch

Warning about deprecate `set-output` command still visible in `v1.0.8`

Hi, I updated my workflow to use v1.0.8 and I'm still seeing two warnings about set-output. I created a new issue because no one reacted to my earlier comment.

My repo:

Run joerick/[email protected]

Found label  do-not-merge 
  Setting env var for remaining steps: GITHUB_PR_LABEL_DO_NOT_MERGE=1

Action output:
labels: " do-not-merge "
labels-object: {"do-not-merge":true}
Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

Latest PR check in this repo https://github.com/joerick/pr-labels-action/actions/runs/4469843040/jobs/7852529676:

Run ./
Not a pull request
Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/[2](https://github.com/joerick/pr-labels-action/actions/runs/4469843040/jobs/7852529676#step:3:3)022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

This will start failing soon on June 1st.

Originally posted by @kimlep01 in #9 (comment)

Labels not available when creating PR

I have a workflow that uses actions/labeler to set the PR labels. Workflow yaml looks as follows:

name: Pull request checks

on:
  pull_request:
    types:
      - edited
      - opened
      - reopened
      - synchronize

jobs:
  label-pr:
    name: Add PR labels
    runs-on: ubuntu-latest
    steps:
      - name: PR labeler ๐Ÿท
        id: add_labels
        uses: actions/labeler@v3
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"

  get-pr-labels:
    name: Get the PR labels
    runs-on: ubuntu-latest
    needs: label-pr
    outputs:
      labels: ${{ steps.get_pr_labels.outputs.labels }}
    steps:
      - name: Get PR labels ๐Ÿท๏ธ
        id: get_pr_labels
        uses: joerick/[email protected]

From the label-pr we get the following partial log

##[debug]processing curated-data
##[debug] checking pattern "dags/dmart/curated_data/sql/*.*"
##[debug]  checking "any" patterns
##[debug]    matching patterns against file dags/dmart/curated_data/sql/_dim_product_catalog_updates.sql
##[debug]   - dags/dmart/curated_data/sql/*.*
##[debug]   all patterns matched
##[debug]  "any" patterns matched against dags/dmart/curated_data/sql/_dim_product_catalog_updates.sql

which shows that a label was indeed matched. Such label also appears in the PR

image

Yet, the log for get-pr-labels shows the following:

image

No labels were found!

If I re-run all jobs, the same result is observed.

Yet, if any other event occurs, the labels are found. In this case a simple changing of the PR title did the trick (this is because the workflow triggers on PR synchronize).

image

Not sure how this behaviour could be changed, but it would be nice if the action could detect the labels added during the workflow run in which it is used.


This might be quite tricky to achieve since from the github.event.pull_request context I can see that, when the PR is opened we get:

{
  ...
  "event": {
    "action": "opened",
    "pull_request": {
      ...
      "labels": [],
      ...
    }
  ...
}

But after any other event

{
  ...
  "event": {
    "action": "synchronize",
    "pull_request": {
      ...
      "labels": [
        {
          "color": "cfd3d7",
          "default": false,
          "description": "dmart",
          "id": 4351199434,
          "name": "dmart",
          "node_id": "LA_kwDOHsmXus8AAAABA1oIyg",
          "url": "https://api.github.com/repos/daczarne/github_actions_test/labels/dmart"
        },
        {
          "color": "7057ff",
          "default": false,
          "description": "Curated data",
          "id": 4351199439,
          "name": "curated-data",
          "node_id": "LA_kwDOHsmXus8AAAABA1oIzw",
          "url": "https://api.github.com/repos/daczarne/github_actions_test/labels/curated-data"
        }
      ],
      ...
    }
  ...
}

So it looks as if the labels themselves are out the context at create time.

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.