Skip to content

Commit 0dda25f

Browse files
author
alrex
authored
adding workflow to update website (open-telemetry#1789)
1 parent d8ddb9b commit 0dda25f

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/docs-update.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Update OpenTelemetry Website Docs
2+
3+
on:
4+
# triggers only on a manual dispatch
5+
workflow_dispatch:
6+
7+
jobs:
8+
update-docs:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: checkout
12+
uses: actions/checkout@v2
13+
- name: make-pr
14+
env:
15+
API_TOKEN_GITHUB: ${{secrets.DOC_UPDATE_TOKEN}}
16+
# Destination repo should always be 'open-telemetry/opentelemetry.io'
17+
DESTINATION_REPO: open-telemetry/opentelemetry.io
18+
# Destination path should be the absolute path to your language's friendly name in the docs tree (i.e, 'content/en/docs/python')
19+
DESTINATION_PATH: content/en/docs/python
20+
# Source path should be 'website_docs', all files and folders are copied from here to dest
21+
SOURCE_PATH: website_docs
22+
run: |
23+
TARGET_DIR=$(mktemp -d)
24+
export GITHUB_TOKEN=$API_TOKEN_GITHUB
25+
git config --global user.name austinlparker
26+
git config --global user.email austin@lightstep.com
27+
git clone "https://$API_TOKEN_GITHUB@github.com/$DESTINATION_REPO.git" "$TARGET_DIR"
28+
rsync -av --delete "$SOURCE_PATH/" "$TARGET_DIR/$DESTINATION_PATH/"
29+
cd "$TARGET_DIR"
30+
git checkout -b docs-$GITHUB_REPOSITORY-$GITHUB_SHA
31+
git add .
32+
git commit -m "Docs update from $GITHUB_REPOSITORY"
33+
git push -u origin HEAD:docs-$GITHUB_REPOSITORY-$GITHUB_SHA
34+
gh pr create -t "Docs Update from $GITHUB_REPOSITORY" -b "This is an automated pull request." -B main -H docs-$GITHUB_REPOSITORY-$GITHUB_SHA
35+
echo "done"

0 commit comments

Comments
 (0)