Files
mlflow--mlflow/.github/workflows/remove-experimental-decorators.yml
2026-07-13 13:22:34 +08:00

84 lines
2.9 KiB
YAML

name: Remove Experimental Decorators
on:
schedule:
# Run on the 1st day of every month at 00:00 UTC
- cron: "0 0 1 * *"
workflow_dispatch: # Allow manual triggering
pull_request:
paths:
- .github/workflows/remove-experimental-decorators.yml
- dev/remove_experimental_decorators.py
defaults:
run:
shell: bash
permissions: {}
jobs:
remove-decorators:
runs-on: ubuntu-slim
timeout-minutes: 5
# Only run on the main repository
if: github.repository == 'mlflow/mlflow'
permissions:
contents: write
pull-requests: write
env:
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
steps:
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
if: github.event_name != 'pull_request'
id: app-token
with:
client-id: ${{ secrets.APP_CLIENT_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
permission-contents: write
permission-pull-requests: write
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: true
token: ${{ steps.app-token.outputs.token || github.token }}
- name: Run remove_experimental_decorators script
id: remove
run: |
python dev/remove_experimental_decorators.py
[[ -n $(git status --porcelain) ]] && has_changes=true || has_changes=false
echo "has_changes=$has_changes" >> $GITHUB_OUTPUT
- name: Create branch, commit and push changes
if: steps.remove.outputs.has_changes == 'true' && github.event_name != 'pull_request'
id: branch
run: |
git config user.name 'mlflow-app[bot]'
git config user.email 'mlflow-app[bot]@users.noreply.github.com'
TIMESTAMP=$(date +%Y-%m-%d-%H-%M-%S)
BRANCH_NAME="automated/remove-experimental-decorators-${TIMESTAMP}"
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
git checkout -b $BRANCH_NAME
git add -A
git commit -m "Remove expired experimental decorators
Generated by: ${RUN_URL}"
git push origin $BRANCH_NAME
- name: Create Pull Request
if: steps.remove.outputs.has_changes == 'true' && github.event_name != 'pull_request'
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
BRANCH_NAME: ${{ steps.branch.outputs.branch_name }}
run: |
PR_BODY=$(printf "Generated by [workflow run](${RUN_URL})\n\nTo skip auto-removal for an API, use \`@experimental(version=..., skip=True)\`.")
PR_URL=$(gh pr create \
--title "Remove expired experimental decorators" \
--body "$PR_BODY" \
--base master \
--head "$BRANCH_NAME")
gh pr edit "$PR_URL" --add-label "team-review"