Skip to content

Commit d2eaa31

Browse files
committed
Format
1 parent c1682f2 commit d2eaa31

File tree

4 files changed

+44
-11
lines changed

4 files changed

+44
-11
lines changed

.github/workflows/pr-review.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ on:
66
types:
77
- submitted
88

9+
permissions: read-all
10+
911
jobs:
10-
approved:
12+
add-owner-approved-label:
1113
if: github.event.review.state == 'approved'
1214
runs-on: ubuntu-latest
1315
steps:
@@ -21,6 +23,6 @@ jobs:
2123
run: ./.github/workflows/scripts/add-labels-to-reviewed-pr.sh
2224
env:
2325
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24-
ISSUE: ${{ github.event.issue.number }}
25-
COMMENT: ${{ github.event.comment.body }}
26-
SENDER: ${{ github.event.sender.login }}
26+
REPO: ${{ github.repository }}
27+
PR: ${{ github.event.number }}
28+

.github/workflows/scripts/add-labels-to-reviewed-pr.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
#!/usr/bin/env bash
22
#
33
# Copyright The OpenTelemetry Authors
4-
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
516
#
617
# Adds a "has:owner-approval" label to a PR if a reviewer who approved it is a component owner.
718

@@ -17,7 +28,6 @@ main () {
1728

1829
# The latestReviews key returns the latest review for each reviewer cutting out any other reviews.
1930
JSON=$(gh pr view "${PR}" --json "files,author,latestReviews" | tr -dc '[:print:]' | sed -E 's/\\[a-z]//g')
20-
AUTHOR=$(echo -n "${JSON}"| jq -r '.author.login')
2131
FILES=$(echo -n "${JSON}"| jq -r '.files[].path')
2232
LATEST_REVIEWS=$(echo -n "${JSON}" | jq -c '.latestReviews')
2333

@@ -40,7 +50,6 @@ main () {
4050
if [[ -v PROCESSED_COMPONENTS["${COMPONENT}"] ]]; then
4151
continue
4252
fi
43-
4453
PROCESSED_COMPONENTS["${COMPONENT}"]=true
4554

4655
# Check if updated file is owned by one of the reviewers"
@@ -63,4 +72,4 @@ main () {
6372
}
6473

6574
# Ensure the script does not block a PR even if it fails
66-
main || echo "Failed to run $0"
75+
main || echo "Failed to run $0"

.github/workflows/scripts/get-codeowners.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
#!/usr/bin/env bash
22
#
33
# Copyright The OpenTelemetry Authors
4-
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
516
#
617
# Gets the owners for a given component from the component_owners.yml file.
718

.github/workflows/scripts/get-components.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
#!/usr/bin/env bash
22
#
33
# Copyright The OpenTelemetry Authors
4-
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
516
#
617
# Gets the components from the component_owners.yml file.
718

@@ -17,4 +28,4 @@ while IFS= read -r line; do
1728
COMPONENT=$(echo "$line" | sed -E 's/^[[:space:]]*([^:]+):.*/\1/')
1829
echo "$COMPONENT"
1930
fi
20-
done < "$YML_FILE"
31+
done < "$YML_FILE"

0 commit comments

Comments
 (0)