-
Notifications
You must be signed in to change notification settings - Fork 258
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
add github actions bot with a hint comment for contributors. #147
base: main
Are you sure you want to change the base?
Conversation
Strange, the bot message works locally: fsb4000/test#1 but here I got:
|
I found the article: https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/ It will not work at PR before merging: fsb4000/test#2 But I hope it will work after: fsb4000/test#3 |
Signed-off-by: Igor Zhukov <ivzhukov@sbercloud.ru>
An example of an other project bot message: apache/airflow#25083 (comment) |
it seems that we have openstack-mirroring bot: openstack/neutron#57 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An explanation of how/why to deal w/ permissions.
Also, best practice is to favor GH_TOKEN
over GITHUB_TOKEN
-- github wants to reserve the GITHUB_
environment variable prefix for its own purposes. `
|
||
jobs: | ||
comment: | ||
runs-on: ubuntu-latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
runs-on: ubuntu-latest | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write |
https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#create-an-issue
The fine-grained token must have the following permission set:
"Issues" repository permissions (write)
Default permissions for repositories depend on when the repository/user/organization/enterprise was created. Newer organizations are created with more restrictive permissions. Older entities should be upgraded to restricted permissions, but until they are, you'll be able to do things w/o declaring permissions and will experience problems trying to share those workflows to restricted containers.
- name: Add comment to PR | ||
env: | ||
URL: ${{ github.event.pull_request.comments_url }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_TOKEN: ${{ github.token }} | |
-X POST \ | ||
$URL \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: token $GITHUB_TOKEN" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-H "Authorization: token $GITHUB_TOKEN" \ | |
-H "Authorization: token $GH_TOKEN" \ | |
```\n | ||
|
||
run: | | ||
curl \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're using curl
, but this could really be done using gh api
instead.
Not for a merge but for demonstration for
ovs-discuss@openvswitch.org
I thought about how best to reuse 0day robot checks, and I came up with the idea that it’s better not to create a pipeline with the checks, but it’s better to just tell contributors about how to submit a patch, what code style is used, and about 0day robot checks.