mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-09 15:37:56 -05:00
Use curl for connecting to github API to add reviewer team to automated PRs (#10813)
* Add workaround for gh cli not being able to add reviewer teams to PRs. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Use curl for connecting to github API to add reviewer team to automated PRs. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Move adding reviewers to a separate step. Signed-off-by: Satadru Pramanik <satadru@gmail.com> --------- Signed-off-by: Satadru Pramanik <satadru@gmail.com>
This commit is contained in:
committed by
GitHub
parent
890b9eea93
commit
d63f2ec945
22
.github/workflows/Updater.yml
vendored
22
.github/workflows/Updater.yml
vendored
@@ -178,7 +178,7 @@ jobs:
|
|||||||
"satmandu/crewbuild:${CONTAINER}" \
|
"satmandu/crewbuild:${CONTAINER}" \
|
||||||
/bin/chromebrewstart /output/tools/github_actions_update_builder.sh > >(tee -a /tmp/build.log) 2> >(tee -a /tmp/build.log >&2)
|
/bin/chromebrewstart /output/tools/github_actions_update_builder.sh > >(tee -a /tmp/build.log) 2> >(tee -a /tmp/build.log >&2)
|
||||||
grep "Built and Uploaded:" /tmp/build.log
|
grep "Built and Uploaded:" /tmp/build.log
|
||||||
sudo rm -rf release manifest
|
sudo rm -rf release
|
||||||
- name: Add updated packages to PR.
|
- name: Add updated packages to PR.
|
||||||
id: push-check
|
id: push-check
|
||||||
env:
|
env:
|
||||||
@@ -218,12 +218,18 @@ jobs:
|
|||||||
git config --global user.name 'github-actions[bot]'
|
git config --global user.name 'github-actions[bot]'
|
||||||
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||||
git fetch --depth=5
|
git fetch --depth=5
|
||||||
mapfile -t updated_packages < <( git diff-tree --no-commit-id --name-only -r $(git log --oneline | grep $CREW_BRANCH | tail -n 1 | awk '{print $1}')..$(git rev-parse --verify HEAD) | grep -v manifest)
|
mapfile -t updated_package_array < <( git diff-tree --no-commit-id --name-only -r $(git log --oneline | grep $CREW_BRANCH | tail -n 1 | awk '{print $1}')..$(git rev-parse --verify HEAD) | grep -v manifest | grep "^packages" | sed -e 's,packages/,,' -e 's,.rb,,')
|
||||||
export UPDATED_FILES="Updated packages:$(echo '';for file in "${updated_packages[@]}" ; do echo "- ${file}" ; done)"
|
UPDATED_PACKAGES="Updated packages:
|
||||||
gh pr create --title "Automatic PR to update packages for ${{ needs.update-check.outputs.output1 }}" --body "${UPDATED_FILES}"
|
$(for file in "${updated_package_array[@]}" ; do echo "- ${file}" ; done)"
|
||||||
gh api \
|
echo "${UPDATED_PACKAGES}"
|
||||||
--method POST \
|
gh pr create --title "Automatic PR to update packages for ${{ needs.update-check.outputs.output1 }}" --body "${UPDATED_PACKAGES}"
|
||||||
|
- name: Add active team reviewers to PR
|
||||||
|
run: |
|
||||||
|
export PR_NUMBER="$(gh pr list --search ${{ needs.update-check.outputs.output1 }} --json number | jq -r '.[].number')"
|
||||||
|
echo "PR is #${PR_NUMBER}"
|
||||||
|
curl -X POST \
|
||||||
-H "Accept: application/vnd.github+json" \
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"\
|
||||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||||
/repos/${{ github.repository }}/pulls/$(gh pr list --search ${{ needs.update-check.outputs.output1 }} --json number | jq -r '.[].number')/requested_reviewers \
|
https://api.github.com/repos${{ github.owner }}/${{ github.repository }}/pulls/${PR_NUMBER}/requested_reviewers \
|
||||||
-f "team_reviewers[]=active"
|
-d '{"team_reviewers":["active"]}'
|
||||||
|
|||||||
Reference in New Issue
Block a user