-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add action which automatically runs CI for public OpenXLA GitHub org …
…members FORCE_TEST_AUTORUN_CI PiperOrigin-RevId: 705211520
- Loading branch information
1 parent
209cbfa
commit 58de9c2
Showing
3 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright 2023 The TensorFlow Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ============================================================================ | ||
"""Autoruns CI for OpenXLA org members with membership set to public.""" | ||
import os | ||
|
||
import github_api | ||
|
||
_OPENXLA_ORG_ID = 107584881 # https://api.github.com/orgs/107584881 | ||
|
||
|
||
def main(): | ||
username = os.getenv("PR_AUTHOR_USERNAME") | ||
pr_number = os.getenv("PR_NUMBER") | ||
api = github_api.GitHubAPI() | ||
|
||
orgs = api.get_user_orgs(username) | ||
print(orgs) | ||
|
||
if _OPENXLA_ORG_ID in {org.id for org in orgs}: | ||
api.add_issue_labels("openxla/xla", pr_number, ["invalid"]) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright 2024 The OpenXLA Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ============================================================================ | ||
name: Autorun CI for OpenXLA Public Members | ||
permissions: | ||
pull-requests: write | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
autorun-ci: | ||
runs-on: ubuntu-22.04 | ||
defaults: | ||
run: | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
PR_NUMBER: ${{ github.event.number }} | ||
PR_AUTHOR_USERNAME: ${{ github.event.pull_request.user.login }} | ||
timeout-minutes: 6 | ||
if: | | ||
github.event.sender.type == 'User' || | ||
contains(github.event.pull_request.body, 'FORCE_TEST_AUTORUN_CI') | ||
steps: | ||
- name: "Checking out repository" | ||
uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 | ||
- name: "Autorun CI for public OpenXLA org members" | ||
run: python3 .github/workflows/autorun_ci.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters