|
| 1 | +name: Remove Experimental Decorators |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run on the 1st day of every month at 00:00 UTC |
| 6 | + - cron: "0 0 1 * *" |
| 7 | + workflow_dispatch: # Allow manual triggering |
| 8 | + |
| 9 | +defaults: |
| 10 | + run: |
| 11 | + shell: bash |
| 12 | + |
| 13 | +jobs: |
| 14 | + remove-decorators: |
| 15 | + runs-on: ubuntu-slim |
| 16 | + timeout-minutes: 5 |
| 17 | + # Only run on the main repository |
| 18 | + if: github.repository == 'mlflow/mlflow' |
| 19 | + permissions: |
| 20 | + contents: write |
| 21 | + pull-requests: write |
| 22 | + env: |
| 23 | + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| 24 | + steps: |
| 25 | + - uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0 |
| 26 | + id: app-token |
| 27 | + with: |
| 28 | + app-id: ${{ secrets.APP_ID }} |
| 29 | + private-key: ${{ secrets.APP_PRIVATE_KEY }} |
| 30 | + |
| 31 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 32 | + with: |
| 33 | + token: ${{ steps.app-token.outputs.token }} |
| 34 | + |
| 35 | + - uses: ./.github/actions/setup-python |
| 36 | + |
| 37 | + - name: Run remove_experimental_decorators script |
| 38 | + id: remove |
| 39 | + run: | |
| 40 | + python dev/remove_experimental_decorators.py |
| 41 | +
|
| 42 | + [[ -n $(git status --porcelain) ]] && has_changes=true || has_changes=false |
| 43 | + echo "has_changes=$has_changes" >> $GITHUB_OUTPUT |
| 44 | +
|
| 45 | + - name: Create branch, commit and push changes |
| 46 | + if: steps.remove.outputs.has_changes == 'true' |
| 47 | + id: branch |
| 48 | + run: | |
| 49 | + git config user.name 'mlflow-app[bot]' |
| 50 | + git config user.email 'mlflow-app[bot]@users.noreply.github.com' |
| 51 | +
|
| 52 | + TIMESTAMP=$(date +%Y-%m-%d-%H-%M-%S) |
| 53 | + BRANCH_NAME="automated/remove-experimental-decorators-${TIMESTAMP}" |
| 54 | + echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT |
| 55 | + git checkout -b $BRANCH_NAME |
| 56 | +
|
| 57 | + git add -A |
| 58 | + git commit -m "Remove expired experimental decorators |
| 59 | +
|
| 60 | + Generated by: ${RUN_URL}" |
| 61 | + git push origin $BRANCH_NAME |
| 62 | +
|
| 63 | + - name: Create Pull Request |
| 64 | + if: steps.remove.outputs.has_changes == 'true' |
| 65 | + env: |
| 66 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| 67 | + BRANCH_NAME: ${{ steps.branch.outputs.branch_name }} |
| 68 | + run: | |
| 69 | + gh pr create \ |
| 70 | + --title "Remove expired experimental decorators" \ |
| 71 | + --body "Generated by [workflow run](${RUN_URL})" \ |
| 72 | + --base master \ |
| 73 | + --head "$BRANCH_NAME" |
0 commit comments