-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
92 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Adapted from https://github.com/paygoc6/action-pull-request-another-repo | ||
|
||
CLONE_DIR=$(mktemp -d) | ||
|
||
echo "Setting git variables" | ||
export GITHUB_TOKEN=$API_TOKEN_GITHUB | ||
git config --global user.email "$USER_EMAIL" | ||
git config --global user.name "$USER_NAME" | ||
|
||
date=$(date '+%Y-%m-%d_%H-%M') | ||
DESTINATION_HEAD_BRANCH="$DESTINATION_HEAD_BRANCH-$date" | ||
|
||
echo "Cloning destination git repository" | ||
git clone "https://$API_TOKEN_GITHUB@github.com/$DESTINATION_REPO.git" "$CLONE_DIR" | ||
cd "$CLONE_DIR" | ||
git checkout "$DESTINATION_BASE_BRANCH" | ||
git pull origin "$DESTINATION_BASE_BRANCH" | ||
git checkout -b "$DESTINATION_HEAD_BRANCH" | ||
|
||
echo "Copying contents to git repo" | ||
mkdir -p "$CLONE_DIR/$DESTINATION_FOLDER" | ||
cp -r "$SOURCE_FOLDER/." "$CLONE_DIR/$DESTINATION_FOLDER/" | ||
|
||
echo "Adding files" | ||
git add . | ||
echo "Git status:" | ||
git status -- ":!date.js" | ||
if git status -- ":!date.js" | grep -q "Changes to be committed" | ||
then | ||
echo "Adding git commit" | ||
git commit -m "$COMMIT_MESSAGE" | ||
echo "Pushing git commit" | ||
git push -u origin "$DESTINATION_HEAD_BRANCH" | ||
echo "Creating a pull request" | ||
gh pr create -t "$PR_TITLE" \ | ||
-B "$DESTINATION_BASE_BRANCH" \ | ||
-b "" \ | ||
-H "$DESTINATION_HEAD_BRANCH" | ||
else | ||
echo "No changes detected" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: documentation | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'master' | ||
jobs: | ||
Push-Docs-To-Website: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
architecture: 'x64' | ||
- name: Install Python dependencies | ||
run: pip install jinja2 typedecorator markdown | ||
- name: Compile documentation | ||
run: | | ||
cd ${{ github.workspace }}/docs/ | ||
python -m ElunaDoc | ||
- name: Create pull request | ||
run: | | ||
chmod +x "${GITHUB_WORKSPACE}/.github/workflows/create-pr.sh" | ||
"${GITHUB_WORKSPACE}/.github/workflows/create-pr.sh" | ||
env: | ||
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | ||
SOURCE_FOLDER: '${{ github.workspace }}/docs/build' | ||
DESTINATION_REPO: 'elunaluaengine/elunaluaengine.github.io' | ||
DESTINATION_FOLDER: '' | ||
DESTINATION_BASE_BRANCH: 'master' | ||
DESTINATION_HEAD_BRANCH: 'master' | ||
PR_TITLE: 'Update Eluna documentation' | ||
COMMIT_MESSAGE: 'Update Eluna documentation' | ||
USER_EMAIL: '[email protected]' | ||
USER_NAME: 'Foereaper' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters