Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Lok <[email protected]>
  • Loading branch information
daniellok-db committed Feb 13, 2024
1 parent 908dc49 commit 31676a4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 16 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/warn-on-updating-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ jobs:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
pip install requests
- name: Post warning if file is edited
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const warn = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/warn-requirements.js`);
await warn({ context, github });
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python dev/warn_on_editing_requirements.py \
--pull-number ${{ github.event.pull_request.number }}
11 changes: 0 additions & 11 deletions .github/workflows/warn-requirements.js

This file was deleted.

29 changes: 29 additions & 0 deletions dev/warn_on_editing_requirements.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import argparse
import os

import requests


def comment(pull_number):
body = (
"⚠️ Warning: It looks like you're editing requirements for MLflow. "
"Please ensure that this doesn't cause any dependency conflicts with "
"downstream tasks that depend on MLflow (e.g. image building)."
)
token = os.environ.get("GITHUB_TOKEN")
headers = {"Authorization": f"token {token}"}
requests.post(
f"https://api.github.com/repos/mlflow/mlflow/issues/{pull_number}/comments",
json={"body": body},
headers=headers,
)


def main():
parser = argparse.ArgumentParser()
parser.add_argument("--pull-number", required=True)
comment(parser.parse_args().pull_number)


if __name__ == "__main__":
main()

0 comments on commit 31676a4

Please sign in to comment.