forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (70 loc) · 2.88 KB
/
datamodel-doc.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
name: Rebuild data model documentation
on:
workflow_dispatch:
schedule:
- cron: '17 1 * * *' # 01:17 every night
jobs:
datamodel-doc:
runs-on: ubuntu-latest
if: github.repository == 'AliceO2Group/AliceO2'
steps:
- name: Checkout O2
uses: actions/checkout@v3
with:
path: O2
persist-credentials: false
- name: Checkout O2Physics
uses: actions/checkout@v3
with:
repository: AliceO2Group/O2Physics
path: O2Physics
persist-credentials: false
- name: Checkout documentation
uses: actions/checkout@v3
with:
repository: AliceO2Group/analysis-framework
path: analysis-framework
persist-credentials: false
# To push the updated branch, we need a non-shallow clone.
fetch-depth: 0
- name: Create PR branch in docs
working-directory: analysis-framework
run: |
git config --global user.email '[email protected]'
git config --global user.name 'ALICE Action Bot'
# Overwrite branch, creating a new one based on HEAD
git checkout -B auto-datamodel-doc
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install prerequisites
run: |
python3 -m pip install --user -U numpy nltk
python3 -m nltk.downloader -d ~/nltk_data punkt
python3 -m nltk.downloader -d ~/nltk_data punkt_tab
- name: Generate documentation
run: exec bash -exo pipefail O2/scripts/datamodel-doc/update-datamodel.sh
- name: Send pull request with updated docs
env:
GITHUB_TOKEN: ${{ secrets.ALIBUILD_GITHUB_TOKEN }}
working-directory: analysis-framework/docs/datamodel
run: |
# git diff --quiet exits with 1 if any tracked files have changed, and
# with 0 otherwise.
set -e
if git diff --quiet; then
exit # Nothing has changed, so no need to send a PR.
fi
git add ao2dTables.md helperTaskTables.md pwgTables.md joinsAndIterators.md
git commit -m 'Automatic data model update'
git remote set-url origin "https://alibuild:[email protected]/alibuild/analysis-framework"
git push -f origin auto-datamodel-doc
# Send pull request
# We need to use "gh" ourselves because alisw/pull-request gets
# confused when multiple repos are checked out.
GH_TOKEN="$GITHUB_TOKEN" gh pr create -R AliceO2Group/analysis-framework -B master \
--no-maintainer-edit -t 'Automatic data model update' -b "This update \
to the data model documentation was automatically created from \
tonight's O2 dev branch." || true
# If the PR already exists, hub fails, but we've just force-pushed, so we don't need a new PR.