joerick / pr-labels-action Goto Github PK
View Code? Open in Web Editor NEWA Github action that extracts labels from the PR that this build belongs to, and makes them available to other actions.
A Github action that extracts labels from the PR that this build belongs to, and makes them available to other actions.
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
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)
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
Yet, the log for get-pr-labels
shows the following:
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).
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.
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/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.