|
| 1 | +name: Update tutorials |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: ["master"] |
| 6 | + paths: |
| 7 | + - ".github/workflows/docs-tutorials.yml" |
| 8 | + schedule: |
| 9 | + # on Sundays |
| 10 | + - cron: "0 0 * * 0" |
| 11 | + workflow_dispatch: {} |
| 12 | + |
| 13 | +defaults: |
| 14 | + run: |
| 15 | + shell: bash |
| 16 | + |
| 17 | +jobs: |
| 18 | + docs-update: |
| 19 | + runs-on: ubuntu-20.04 |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + submodules: true |
| 24 | + fetch-depth: 0 |
| 25 | + #lfs: true |
| 26 | + |
| 27 | + - name: initial state |
| 28 | + run: | |
| 29 | + git submodule status |
| 30 | + # Skip smudge - We'll download binary files later in a faster batch |
| 31 | + git lfs install --skip-smudge |
| 32 | + - name: update submodules |
| 33 | + env: |
| 34 | + GIT_TRACE: 1 |
| 35 | + run: | |
| 36 | + git submodule sync |
| 37 | + git submodule update --remote --force |
| 38 | + - name: final state |
| 39 | + run: | |
| 40 | + git submodule status |
| 41 | + git status |
| 42 | +
|
| 43 | + short_sha=$(git submodule status | grep -A 1 _notebooks | cut -c1-8) |
| 44 | + echo "SHA_SHORT=$short_sha" >> $GITHUB_ENV |
| 45 | +
|
| 46 | + - name: Create Pull Request |
| 47 | + if: github.event_name != 'pull_request' |
| 48 | + uses: peter-evans/create-pull-request@v5 |
| 49 | + with: |
| 50 | + title: "docs: update ref to latest tutorials" |
| 51 | + committer: GitHub <[email protected]> |
| 52 | + author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> |
| 53 | + token: ${{ secrets.PAT_GHOST }} |
| 54 | + add-paths: _notebooks |
| 55 | + commit-message: "update tutorials to `${{ env.SHA_SHORT }}`" |
| 56 | + branch: "docs/update-tutorials" |
| 57 | + # Delete the branch when closing pull requests, and when undeleted after merging. |
| 58 | + delete-branch: true |
| 59 | + # the PR's body/content |
| 60 | + body: > |
| 61 | + **This is automated update with the latest lighting tutorials!** |
| 62 | + The target commit in the [publication](https://github.com/Lightning-AI/tutorials/tree/publication) |
| 63 | + branch is [${{ env.SHA_SHORT }}](https://github.com/Lightning-AI/tutorials/commit/${{ env.SHA_SHORT }}). |
| 64 | +
|
| 65 | + Before proceeding further double check that the PR include only submodule's head update. |
| 66 | + Eventually some additional adjustments in lightning docs may be needed. |
| 67 | + labels: | |
| 68 | + docs |
| 69 | + examples |
| 70 | + assignees: borda |
| 71 | + reviewers: borda |
0 commit comments