Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Autogen docs #93

Merged
merged 20 commits into from
Jun 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/create-studio-docs-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
on:
pull_request:
branches:
- main

name: create-studio-docs-pr

jobs:
send-pull-request:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: pip install -r requirements.txt

- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Get email
id: email
uses: KRANTHI0918/[email protected]
with:
github-username: ${{ github.event.pull_request.user.login }}
token: ${{ steps.generate_token.outputs.token }}

- name: Get last commit message
run: |
cd ${{ github.workspace }}
git fetch origin ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
echo "LAST_COMMIT_MSG=$(git log -1 --pretty=format:'%s' '${{ github.event.pull_request.head.sha }}' )" >> "$GITHUB_ENV"

- name: Send pull-request
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
APP_TOKEN: ${{ steps.generate_token.outputs.token }}
USER_NAME: ${{ github.event.pull_request.user.login }}
USER_EMAIL: ${{ steps.email.outputs.email }}
LAST_COMMIT_MSG: ${{ env.LAST_COMMIT_MSG }}
PR_NUM: ${{github.event.pull_request.number}}
GITHUB_WORKSPACE: ${{github.workspace}}
PR_BRANCH: ${{ github.head_ref }}
run: |
bash create_pr

This file was deleted.

102 changes: 0 additions & 102 deletions INSTRUMENTS/Serial/Serial_timeseries/SERIAL_TIMESERIES.py

This file was deleted.

98 changes: 98 additions & 0 deletions create_pr
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#!/bin/bash

DOC_REPOSITORY="flojoy-io/docs"
DOC_FOLDER="bin/$DOC_REPOSITORY"
DOC_BRANCH="update-node-docs-$PR_NUM"
STUDIO_REPOSITORY="flojoy-io/studio"
STUDIO_FOLDER="bin/$STUDIO_REPOSITORY"
STUDIO_BRANCH="update-node-manifest-$PR_NUM"


clone()
{
REPO=$1
LOC=$2
GIT_URL=https://x-access-token:[email protected]/$REPO.git
git clone --no-single-branch $GIT_URL $LOC
cd $LOC
git pull
git fetch origin
}


clone "$DOC_REPOSITORY" "$DOC_FOLDER"

git config --local user.name "$USER_NAME" && git config --local user.email "$USER_EMAIL"
git config core.ignorecase false

if git branch -a | grep -q $DOC_BRANCH; then
git checkout $DOC_BRANCH
git pull
cd $GITHUB_WORKSPACE
python3 write_doc_string.py $DOC_FOLDER
cd $DOC_FOLDER
if git status --porcelain | grep -q .; then
echo "There are changes in the branch."
git add .
git commit -m "$LAST_COMMIT_MSG"
git push origin $DOC_BRANCH
fi
else
git checkout -b $DOC_BRANCH
cd $GITHUB_WORKSPACE
python3 write_doc_string.py $DOC_FOLDER
cd $DOC_FOLDER
if git status --porcelain | grep -q .; then
git add .
git commit -m "$LAST_COMMIT_MSG"
git push -u origin $DOC_BRANCH --force
gh pr create \
--body "corresponding PR in nodes: https://github.com/flojoy-io/nodes/pull/$PR_NUM" \
--title "Update nodes doc from PR: $PR_NUM" \
--head "$DOC_BRANCH" \
--base "main" \
--assignee $USER_NAME
fi
fi

clone "$STUDIO_REPOSITORY" "$STUDIO_FOLDER"

git config --local user.name "$USER_NAME" && git config --local user.email "$USER_EMAIL"
git config core.ignorecase false

if git branch -a | grep -q $STUDIO_BRANCH; then
git checkout $STUDIO_BRANCH
git pull
git submodule update --init --recursive
cd PYTHON/nodes
git checkout $PR_BRANCH
git pull
cd ../../
if git status --porcelain | grep -q .; then
echo "There are changes in the branch."
git add .
git commit -m "$LAST_COMMIT_MSG"
git push origin $STUDIO_BRANCH
fi
else
git checkout develop
git pull
git checkout -b $DOC_BRANCH
git checkout -b $STUDIO_BRANCH
git submodule update --init --recursive
cd PYTHON/nodes
git checkout $PR_BRANCH
git pull
cd ../../
if git status --porcelain | grep -q .; then
git add .
git commit -m "$LAST_COMMIT_MSG"
git push -u origin $STUDIO_BRANCH --force
gh pr create \
--body "corresponding PR in nodes: https://github.com/flojoy-io/nodes/pull/$PR_NUM" \
--title "Update submodule from PR: $PR_NUM" \
--head "$STUDIO_BRANCH" \
--base "develop" \
--assignee $USER_NAME
fi
fi
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
black==23.3.0
PyYAML==6.0
Loading