diff --git a/.github/workflows/compile-time-bot.yml b/.github/workflows/compile-time-bot.yml new file mode 100644 index 00000000000000..152b5d76844a28 --- /dev/null +++ b/.github/workflows/compile-time-bot.yml @@ -0,0 +1,31 @@ +name: Compile Time Bot + +on: + issue_comment: + types: + - created + +jobs: + compile-time-bot: + if: >- + github.event.issue.pull_request && + contains(github.event.comment.body, '@llvm-compile-time-bot test') + runs-on: ubuntu-latest + steps: + - name: Fetch LLVM sources + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup Environment + run: | + pip install -r ./llvm/utils/git/requirements.txt + + - name: Run Action + run: | + printf "%s" "$COMMENT_BODY" | + ./llvm/utils/git/github-automation.py \ + --repo "$GITHUB_REPOSITORY" \ + compile-time-bot \ + --pr-number ${{ github.event.issue.number }} + #--token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \ diff --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py index 52523704fe82dc..800462d6bb79d1 100755 --- a/llvm/utils/git/github-automation.py +++ b/llvm/utils/git/github-automation.py @@ -629,6 +629,12 @@ def execute_command(self) -> bool: print(sys.stdin.readlines()) return False +class CompileTimeBot: + def __init__(self, pr_number: int): + self.pr_numer = pr_number + + def run(self) -> bool: + pass parser = argparse.ArgumentParser() parser.add_argument( @@ -688,6 +694,9 @@ def execute_command(self) -> bool: help="Set the default user and email for the git repo in LLVM_PROJECT_DIR to llvmbot", ) +compile_time_bot_parser = subparsers.add_parser("compile-time-bot") +compile_time_bot_parser.add_argument("--pr-number", type=int, required=True) + args = parser.parse_args() if args.command == "issue-subscriber": @@ -720,3 +729,6 @@ def execute_command(self) -> bool: sys.exit(1) elif args.command == "setup-llvmbot-git": setup_llvmbot_git() +elif args.command == "compile-time-bots": + compile_time_bot = CompileTimeBot(args.pr_number) + compile_time_bot.run()