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

Test external PR #467

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/auto_label_pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: PR Auto Label

on:
pull_request_target:
types:
- opened
- reopened

concurrency:
group: '${{ github.workflow }}-${{ github.event_name }} @ ${{ github.event.pull_request.number || github.sha }}'
cancel-in-progress: true

jobs:
assign-reviewer:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Check if PR author is outside collaborator and assign reviewer
env:
PR_AUTHOR_LOGIN: ${{ github.event.pull_request.user.login }}
REPO_NAME: ${{ github.event.repository.full_name }}
PR_NUMBER: ${{ github.event.number }}
run: |
PERMISSION_LEVEL=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/$REPO_NAME/collaborators/$PR_AUTHOR_LOGIN/permission" | jq -r .role_name)

if [ "$PERMISSION_LEVEL" == "none" ] || [ "$PERMISSION_LEVEL" == "read" ]; then
echo "PR author is an outside collaborator. Adding label..."

curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '["outside collaborator"]' \
"https://api.github.com/repos/$REPO_NAME/issues/$PR_NUMBER/labels"
fi
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Organization <fnmatch pattern>
#
# See python fnmatch module documentation for more information.
# Test external change

The Chromium Authors <*@chromium.org>
Google Inc. <*@google.com>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cobalt [![Build Matrix](https://img.shields.io/badge/-Build%20Matrix-blueviolet)](https://github.com/youtube/cobalt/blob/main/BUILD_STATUS.md)

[![codecov](https://codecov.io/github/youtube/cobalt/branch/main/graph/badge.svg?token=QZY8I830S6)](https://codecov.io/github/youtube/cobalt)
[![codecov](https://codecov.io/github/youtube/cobalt/branch/main/graph/badge.svg?token=QZY8I830S6)](https://codecov.io/github/youtube/cobalt_sandbox)
[![lint](https://github.com/youtube/cobalt/actions/workflows/lint.yaml/badge.svg?branch=main&event=push)](https://github.com/youtube/cobalt/actions/workflows/lint.yaml?query=event%3Apush+branch%3Amain)
[![java](https://github.com/youtube/cobalt/actions/workflows/gradle.yaml/badge.svg?branch=main&event=push)](https://github.com/youtube/cobalt/actions/workflows/gradle.yaml?query=event%3Apush+branch%3Amain)
[![python](https://github.com/youtube/cobalt/actions/workflows/pytest.yaml/badge.svg?branch=main&event=push)](https://github.com/youtube/cobalt/actions/workflows/pytest.yaml?query=event%3Apush+branch%3Amain) \
Expand Down