Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1104] add GitHub workflow to label PRs automatically #1142

Merged
merged 13 commits into from
Feb 1, 2023

Conversation

Harry262530
Copy link
Contributor

@Harry262530 Harry262530 commented Jan 21, 2023

Purpose

Implement a GitHub workflow that automatically assigns labels to PRs.
Fur this purpose consider to use the following GitHub action: https://github.com/actions/labeler

ToDos:

  • provide config file to define labeling rules
  • implement GitHub workflow that runs for every created PR and assigns labels to it

Remarks

PR introduces (a) breaking change(s): no

PR introduces (a) deprecation(s): no

@bossenti bossenti changed the title pull request for auto pr labeler [#1104] add GitHub workflow to label PRs automatically Jan 21, 2023
@bossenti bossenti linked an issue Jan 21, 2023 that may be closed by this pull request
2 tasks
Copy link
Contributor

@bossenti bossenti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks lot for initiative @Harry262530 🙏🏼
Don't worry about the configuration file, I can take care of that part, but I'm not sure when I'll find the time, so it might take a while.

@@ -0,0 +1,21 @@
# Add repo label to any change in any file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just the example config from the GitHub action, right?
That does not suit for us, but that's not a problem.
I will take care of adapting the config accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yah,
basically i was trying to give at least one label to any issue as 'repo'

Copy link
Contributor

@bossenti bossenti Jan 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, but we don't use such a label
You can find an overview of all our labels here
Feel free to improve the config, if you want to

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure,
i will try my level best

run-name: ${{ github.actor }} created Pull Request Labeler

on:
- pull_request_target
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am not mistaken, this event is only produced when a PR from a forked repository is created.
This is not what we desire here. I think the more general pull_request event is better suited for us and we should filter on opening events. Read more about that here: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the advice
should I change it and then send another pr?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just leave this PR open and push new commits to your existing branch, then this PR is updated automatically

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure,
i'll do that

config_merge.yml Outdated
@@ -0,0 +1,18 @@
name: 'PRLabeler'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of this file?
From my understanding, we only need the other two files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually for the past 1 day i studied about pull request and labels so I saw this file on one repo, so I included it

Copy link
Contributor

@bossenti bossenti Jan 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide me with a link to an example?

on:
- pull_request_target

jobs:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if you could filter for PRs created by @dependabot
To do so you can follow this example here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should i assign permissions ,contents and pull request or just leave it for default

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks fine for now

@@ -0,0 +1,46 @@
backend:
# TODO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tenthe @dominikriemer what do you think we should provide here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's possible but we could filter for all modules starting with streampipes-* except streampipes-extensions and non-java modules

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had the same idea, I'll have a look if the config's syntax allows for that

@bossenti
Copy link
Contributor

@tenthe @dominikriemer I came with an initial version of the label config
Although, I'm not really user whether all these file path filters will work, I would just give it a try
What do you think?

Copy link
Member

@dominikriemer dominikriemer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@@ -0,0 +1,46 @@
backend:
# TODO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's possible but we could filter for all modules starting with streampipes-* except streampipes-extensions and non-java modules


'pipeline elements':
- streampipes-exensions/streampipes-extensions-*/**/*
- streampipes-extensions/streampipes-pipeline-*/**/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have such a module in streampipes-extensions currently?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bossenti bossenti added enhancement New feature or request gh-actions Pull requests that update GitHub Actions code labels Feb 1, 2023
@bossenti bossenti added the no release note Issues and PR. Add if they should not be contained in the release notes (e.g., minor refactorings). label Feb 1, 2023
@bossenti bossenti added this to the 0.91.0 milestone Feb 1, 2023
@bossenti bossenti merged commit 2b256ee into apache:dev Feb 1, 2023
@bossenti bossenti removed this from the 0.91.0 milestone Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gh-actions Pull requests that update GitHub Actions code no release note Issues and PR. Add if they should not be contained in the release notes (e.g., minor refactorings).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add GitHub wofklow that tags PR
4 participants