forked from open-telemetry/opentelemetry-python
-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (33 loc) · 1.54 KB
/
docs-update.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
name: Update OpenTelemetry Website Docs
on:
# triggers only on a manual dispatch
workflow_dispatch:
jobs:
update-docs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: make-pr
env:
API_TOKEN_GITHUB: ${{secrets.DOC_UPDATE_TOKEN}}
# Destination repo should always be 'open-telemetry/opentelemetry.io'
DESTINATION_REPO: open-telemetry/opentelemetry.io
# Destination path should be the absolute path to your language's friendly name in the docs tree (i.e, 'content/en/docs/python')
DESTINATION_PATH: content/en/docs/python
# Source path should be 'website_docs', all files and folders are copied from here to dest
SOURCE_PATH: website_docs
run: |
TARGET_DIR=$(mktemp -d)
export GITHUB_TOKEN=$API_TOKEN_GITHUB
git config --global user.name austinlparker
git config --global user.email [email protected]
git clone "https://[email protected]/$DESTINATION_REPO.git" "$TARGET_DIR"
rsync -av --delete "$SOURCE_PATH/" "$TARGET_DIR/$DESTINATION_PATH/"
cd "$TARGET_DIR"
git checkout -b docs-$GITHUB_REPOSITORY-$GITHUB_SHA
git add .
git commit -m "Docs update from $GITHUB_REPOSITORY"
git push -u origin HEAD:docs-$GITHUB_REPOSITORY-$GITHUB_SHA
gh pr create -t "Docs Update from $GITHUB_REPOSITORY" -b "This is an automated pull request." -B main -H docs-$GITHUB_REPOSITORY-$GITHUB_SHA
echo "done"