Skip to content

Commit ceaafd8

Browse files
authored
feat: push docs to combinator automatically (#7)
* docs: push readme to combinator automatically * chore: linting * chore: run only on main/masater
1 parent 9880914 commit ceaafd8

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

.github/workflows/combinator-docs.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Update Combinator Docs
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- master
7+
jobs:
8+
docs:
9+
runs-on: ubuntu-latest
10+
env:
11+
COMBINATOR_DOCS_FILE: docs/components/data/feast.md
12+
COMBINATOR_REPO: combinator-ml/combinator
13+
COMBINATOR_PATH: combinator
14+
LOCAL_PATH: local
15+
steps:
16+
- name: Checkout Local
17+
uses: actions/checkout@v2
18+
with:
19+
path: ${{ env.LOCAL_PATH }}
20+
- name: Checkout Combinator Website
21+
uses: actions/checkout@v2
22+
with:
23+
token: ${{ secrets.CI_TOKEN }}
24+
repository: ${{ env.COMBINATOR_REPO }}
25+
path: ${{ env.COMBINATOR_PATH }}
26+
- name: Checkout Branch
27+
run: |
28+
cd ${COMBINATOR_PATH}
29+
git checkout -b docs/${GITHUB_REPOSITORY}
30+
git pull origin docs/${GITHUB_REPOSITORY} || true
31+
- name: Copy Readme
32+
run: |
33+
cp ./${LOCAL_PATH}/README.md ./${COMBINATOR_PATH}/${COMBINATOR_DOCS_FILE}
34+
- name: Create PR
35+
env:
36+
GIT_USERNAME: action
37+
GIT_EMAIL: action@github.com
38+
run: |
39+
cd ${COMBINATOR_PATH}
40+
git config --local user.name "${GIT_USERNAME}"
41+
git config --local user.email "${GIT_EMAIL}"
42+
if [ -z "$(git status --porcelain)" ]; then
43+
echo "Your docs are up-to-date, no PR required."
44+
else
45+
echo "Docs are out of date"
46+
git --no-pager diff
47+
git add .
48+
git commit -m "docs: auto-update docs from ${GITHUB_REPOSITORY}"
49+
git push --set-upstream origin docs/${GITHUB_REPOSITORY}
50+
curl \
51+
-X POST \
52+
-H "Authorization: token ${{ secrets.CI_TOKEN }}" \
53+
-H "Accept: application/vnd.github.v3+json" \
54+
https://api.github.com/repos/${COMBINATOR_REPO}/pulls \
55+
-d "{\"head\":\"docs/${GITHUB_REPOSITORY}\",\"base\":\"main\", \"title\": \"docs: auto-update docs from ${GITHUB_REPOSITORY}\"}"
56+
fi

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ override.tf.json
2727

2828
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
2929
# example: *tfplan*
30-
kubeconfig
30+
kubeconfig

0 commit comments

Comments
 (0)