-
Notifications
You must be signed in to change notification settings - Fork 894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add automated Schema File publish action #1858
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Update Schema files at OpenTelemetry Website | ||
|
||
on: | ||
# triggers only on a manual dispatch | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update-docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/[email protected] | ||
- 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 directory to publish in | ||
DESTINATION_PATH: static/schemas | ||
# Source path should be 'schemas', all files and folders are copied from here to dest | ||
SOURCE_PATH: schemas | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think so. (This is code is copied from Java repo, I didn't write it, I believe is @austinlparker the author). |
||
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@austinlparker are you ok with the token reuse here?