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

ci: add org member check #14531

Merged
merged 13 commits into from
Jul 22, 2024
Merged

ci: add org member check #14531

merged 13 commits into from
Jul 22, 2024

Conversation

scotthart
Copy link
Member

@scotthart scotthart commented Jul 22, 2024

This change is Reviewable

@scotthart scotthart requested a review from a team as a code owner July 22, 2024 17:25
Copy link

codecov bot commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.59%. Comparing base (7603af8) to head (b071357).
Report is 20 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14531   +/-   ##
=======================================
  Coverage   93.59%   93.59%           
=======================================
  Files        2316     2316           
  Lines      207132   207132           
=======================================
+ Hits       193864   193867    +3     
+ Misses      13268    13265    -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

if: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.author_association != 'MEMBER' }}
run: |
echo "Event not triggered by organization member."
exit 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this make the PR fail hard? How would we run the CI builds for any such PR after it failed?

@@ -43,6 +55,7 @@ jobs:
'external'
}}
name: Require Approval for External PRs
needs: [author-association-member]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you also need to remove the code from line 54? Or is that for a future PR?

Copy link
Member Author

@scotthart scotthart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on @coryan)


.github/workflows/test-runner.yml line 44 at r1 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

Doesn't this make the PR fail hard? How would we run the CI builds for any such PR after it failed?

Added alternate untrusted workflow.


.github/workflows/test-runner.yml line 58 at r1 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

I think you also need to remove the code from line 54? Or is that for a future PR?

Done.

Comment on lines 46 to 52
external-account-integration:
name: External Account Integration
if: ${{ github.event.pull_request.author_association != 'MEMBER' }}
needs: [pre-flight]
uses: ./.github/workflows/external-account-integration.yml
with:
checkout-ref: ${{ needs.pre-flight.outputs.checkout-sha }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think it makes any sense to run this test on a pull request.

Suggested change
external-account-integration:
name: External Account Integration
if: ${{ github.event.pull_request.author_association != 'MEMBER' }}
needs: [pre-flight]
uses: ./.github/workflows/external-account-integration.yml
with:
checkout-ref: ${{ needs.pre-flight.outputs.checkout-sha }}

Comment on lines 141 to 143
*)
exit 0
;;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will do nothing on a pull request, and will only run on pull requests.

Comment on lines 117 to 155
notify:
name: Notify-Google-Chat
# Wait until all the other jobs have completed.
needs:
- external-account-integration
- macos-bazel
- macos-cmake
- windows-bazel
- windows-cmake
# Run even if the other jobs failed or were skipped.
if: always()
runs-on: ubuntu-latest
steps:
- name: Notify Google Chat
shell: bash
run: |
event_name="${{ github.event_name }}"
case "${event_name}" in
schedule)
;;
push)
;;
workflow_dispatch)
;;
*)
exit 0
;;
esac
failure="${{ contains(needs.*.result, 'failure') }}"
cancelled="${{ contains(needs.*.result, 'cancelled') }}"
status=""
# Report whether any of the jobs failed or were cancelled.
if [[ "${cancelled}" == "true" ]]; then status="cancelled"; fi
if [[ "${failure}" == "true" ]]; then status="failure"; fi
# Exit early if there is nothing interesting to report.
if [[ -z "${status}" ]]; then exit 0; fi
printf '{"text": "GHA Build %s %s/%s/actions/runs/%s"}' \
"${status}" "${{ github.server_url }}" "${{ github.repository }}" "${{ github.run_id }}" |
curl -fsX POST -o /dev/null -d@- -H "Content-Type: application/json; charset=UTF-8" '${{ secrets.CLOUD_CPP_BUILD_ALERTS_WEBHOOK }}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
notify:
name: Notify-Google-Chat
# Wait until all the other jobs have completed.
needs:
- external-account-integration
- macos-bazel
- macos-cmake
- windows-bazel
- windows-cmake
# Run even if the other jobs failed or were skipped.
if: always()
runs-on: ubuntu-latest
steps:
- name: Notify Google Chat
shell: bash
run: |
event_name="${{ github.event_name }}"
case "${event_name}" in
schedule)
;;
push)
;;
workflow_dispatch)
;;
*)
exit 0
;;
esac
failure="${{ contains(needs.*.result, 'failure') }}"
cancelled="${{ contains(needs.*.result, 'cancelled') }}"
status=""
# Report whether any of the jobs failed or were cancelled.
if [[ "${cancelled}" == "true" ]]; then status="cancelled"; fi
if [[ "${failure}" == "true" ]]; then status="failure"; fi
# Exit early if there is nothing interesting to report.
if [[ -z "${status}" ]]; then exit 0; fi
printf '{"text": "GHA Build %s %s/%s/actions/runs/%s"}' \
"${status}" "${{ github.server_url }}" "${{ github.repository }}" "${{ github.run_id }}" |
curl -fsX POST -o /dev/null -d@- -H "Content-Type: application/json; charset=UTF-8" '${{ secrets.CLOUD_CPP_BUILD_ALERTS_WEBHOOK }}'

uses: ./.github/workflows/macos-bazel.yml
with:
checkout-ref: ${{ needs.pre-flight.outputs.checkout-sha }}
windows-bazel:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding just one of these until you have finished testing, and then adding them back.

Comment on lines 40 to 44
if: >-
${{
github.event_name == 'pull_request_target' &&
github.event.pull_request.author_association != 'MEMBER'
}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not move this if: section to the pre-flight job?

Copy link
Member Author

@scotthart scotthart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 2 files reviewed, 7 unresolved discussions (waiting on @coryan)


.github/workflows/test-runner.yml line 44 at r3 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

Why not move this if: section to the pre-flight job?

Done.


.github/workflows/test-runner-untrusted.yml line 52 at r3 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

I do not think it makes any sense to run this test on a pull request.

Removed


.github/workflows/test-runner-untrusted.yml line 69 at r3 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

Consider adding just one of these until you have finished testing, and then adding them back.

Done.


.github/workflows/test-runner-untrusted.yml line 143 at r3 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

This will do nothing on a pull request, and will only run on pull requests.

Removed notify job


.github/workflows/test-runner-untrusted.yml line 155 at r3 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

Done.

Copy link
Contributor

@coryan coryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not want to block you here. I need to get ready for some stuff on Wednesday.

@scotthart scotthart merged commit ddfe4dd into main Jul 22, 2024
104 of 105 checks passed
@scotthart scotthart deleted the ci-gha-author-association branch July 22, 2024 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants