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

[chore] Add release:risky-change on PRs touching certain files #12552

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Add code owners to a PR'
name: 'Add labels and code owners to PR'
on:
pull_request_target:
types:
Expand All @@ -8,7 +8,7 @@ on:
permissions: read-all

jobs:
add-owners-to-pr:
add-labels-and-owners:
permissions:
pull-requests: write
runs-on: ubuntu-24.04
Expand All @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Run add-codeowners-to-pr.sh
run: ./.github/workflows/scripts/add-codeowners-to-pr.sh
run: ./.github/workflows/scripts/add-labels-and-owners.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
permissions: read-all

jobs:
add-labels:
add-labels-command:
if: ${{ !github.event.issue.pull_request && startsWith(github.event.comment.body, '/label') && github.repository_owner == 'open-telemetry' }}
permissions:
issues: write
Expand All @@ -15,8 +15,8 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Run add-labels.sh
run: ./.github/workflows/scripts/add-labels.sh
- name: Run add-labels-command.sh
run: ./.github/workflows/scripts/add-labels-command.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE: ${{ github.event.issue.number }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ main () {
# review. The GitHub CLI does not offer a list of all reviewers, which
# is only available through the API. To cut down on API calls to GitHub,
# we use the latest reviews to determine which users to filter out.
JSON=$(gh pr view "${PR}" --json "files,author,latestReviews" | tr -dc '[:print:]' | sed -E 's/\\[a-z]//g')
JSON=$(gh pr view "${PR}" --json "files,author,latestReviews" | LC_ALL=C tr -dc '[:print:]' | sed -E 's/\\[a-z]//g')
AUTHOR=$(echo -n "${JSON}"| jq -r '.author.login')
FILES=$(echo -n "${JSON}"| jq -r '.files[].path')
REVIEW_LOGINS=$(echo -n "${JSON}"| jq -r '.latestReviews[].author.login')
Expand All @@ -52,6 +52,22 @@ main () {
echo "This PR has not yet been reviewed, all code owners are eligible for a review request"
fi

RISKY_REGEX='
^.github/workflows/prepare-release.yml$
|^.github/workflows/scripts/release-prepare-release.sh$
|^Makefile$
|^Makefile.Common$
'
RISKY_REGEX="$(echo "$RISKY_REGEX" | tr -d ' \n')"
RISKY_FILES="$(echo "$FILES" | grep -E "$RISKY_REGEX")"
if [[ -n "${RISKY_FILES}" ]]; then
echo "This PR may affect the release process, as it touches the following files:" \
"$(echo "$RISKY_FILES" | sed -E 's/\n/, /')"
LABELS="release:risky-change"
else
echo "This PR does not have release-affecting changes."
fi

for COMPONENT in ${COMPONENTS}; do
# Files will be in alphabetical order and there are many files to
# a component, so loop through files in an inner loop. This allows
Expand Down
Loading