-
Notifications
You must be signed in to change notification settings - Fork 257
103 lines (88 loc) · 3.48 KB
/
docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: "Docs"
on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'label_studio_ml/examples/**/README.md'
concurrency:
group: "Docs"
cancel-in-progress: true
env:
DOCS_REPO_NAME: "label-studio"
DOCS_REPO_PATH: "label-studio"
DOCS_REPO_PR_BRANCH_NAME: "docs-ml-backend-preview"
DOCS_REPO_PR_REVIEWERS: "caitlinwheeless"
ML_REPO_PATH: "label-studio-ml-backend"
COMMIT_MESSAGE: "docs: Update label-studio-ml-backend docs"
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: hmarr/[email protected]
- name: Checkout Actions Hub
uses: actions/checkout@v4
with:
token: "${{ secrets.GIT_PAT }}"
repository: "HumanSignal/actions-hub"
path: "./.github/actions-hub"
- name: Git Configure
uses: ./.github/actions-hub/actions/git-configure
with:
username: "${{ github.event.sender.login }}"
- name: Find or Create Branch
uses: ./.github/actions-hub/actions/github-find-or-create-branch
id: get-branch
with:
repository: "${{ github.repository_owner }}/${{ env.DOCS_REPO_NAME }}"
base_branch_name: "develop"
branch_name: "${{ env.DOCS_REPO_PR_BRANCH_NAME }}"
github_token: "${{ secrets.GIT_PAT }}"
- name: Checkout ML
uses: actions/checkout@v4
with:
token: "${{ secrets.GIT_PAT }}"
path: "${{ env.ML_REPO_PATH }}"
- name: Checkout LSO
uses: actions/checkout@v4
with:
token: "${{ secrets.GIT_PAT }}"
repository: "${{ github.repository_owner }}/${{ env.DOCS_REPO_NAME }}"
ref: "${{ steps.get-branch.outputs.branch_name }}"
path: "${{ env.DOCS_REPO_PATH }}"
- name: Generate Docs
env:
ML_REPO_PATH: "${{ github.workspace }}/${{ env.ML_REPO_PATH }}"
working-directory: "${{ env.DOCS_REPO_PATH }}"
run: python 'scripts/update_ml_tutorials.py'
- name: Git Commit
working-directory: "${{ env.DOCS_REPO_PATH }}"
run: |
git add 'docs/source/tutorials' || true
git add 'docs/source/guide/ml_tutorials.html' || true
git status -s
git commit -m '${{ env.COMMIT_MESSAGE }}' -m 'Workflow run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' || true
- name: Git Push
uses: ./.github/actions-hub/actions/git-push
with:
working_directory: "${{ env.DOCS_REPO_PATH }}"
- name: Find or Create Pull Request
uses: ./.github/actions-hub/actions/github-find-or-create-pull-request
id: get-pull-request
with:
title: "${{ env.COMMIT_MESSAGE }}"
repository: "${{ github.repository_owner }}/${{ env.DOCS_REPO_NAME }}"
base_branch_name: "develop"
branch_name: "${{ steps.get-branch.outputs.branch_name }}"
github_token: "${{ secrets.GIT_PAT }}"
- name: Add Pull Request Reviewers
uses: ./.github/actions-hub/actions/github-add-pull-request-reviewers
id: add-pull-request-reviewers
with:
repository: "${{ github.repository_owner }}/${{ env.DOCS_REPO_NAME }}"
pullrequest_number: "${{ fromJSON(steps.get-pull-request.outputs.pull).number }}"
reviewers: "${{ env.DOCS_REPO_PR_REVIEWERS }}"
github_token: "${{ secrets.GIT_PAT }}"
- name: Set notice
run: echo "::notice::Pull Request ${{ fromJSON(steps.get-pull-request.outputs.pull).html_url }}"