Skip to content

Commit 0eaa67d

Browse files
Talawa API docs automation workflow created (PalisadoesFoundation#1353)
* Creating a separate repository named "talawa-api-docs" for automated documentation, workflow created * GitHub reference added
1 parent c7aeef4 commit 0eaa67d

File tree

4 files changed

+73
-5967
lines changed

4 files changed

+73
-5967
lines changed

.github/workflows/push.yml

+71
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,74 @@ jobs:
8181
verbose: true
8282
fail_ci_if_error: false
8383
name: '${{env.CODECOV_UNIQUE_NAME}}'
84+
85+
Generate-Documentation:
86+
name: Generate Documentation
87+
runs-on: ubuntu-latest
88+
if: github.ref == 'refs/heads/automated-docs'
89+
needs: Push-Workflow
90+
steps:
91+
- name: Checkout repository
92+
uses: actions/checkout@v3
93+
94+
- name: Generate Documentation of HTML pages
95+
run: |
96+
npm install --global typedoc
97+
npm install typedoc-plugin-markdown
98+
npm i --save-dev @types/node
99+
npx typedoc --entryPoints src --out talawa-api-docs --plugin typedoc-plugin-markdown --theme markdown --entryPointStrategy expand
100+
101+
- name: Checking doc updated
102+
id: DocUpdated
103+
run: |
104+
if [ -n "$(git status --porcelain)" ]; then
105+
echo "updateDoc=true" >> $GITHUB_OUTPUT
106+
echo -e "Documentation has been updated!!"
107+
else
108+
Green='0;32'
109+
NoColor='\033[0m'
110+
echo -e "${Green}No documentation updated${NoColor}"
111+
fi
112+
113+
- name: Set env variables
114+
if: steps.DocUpdated.outputs.updateDoc
115+
run: |
116+
echo "commit_id=$(echo $(git rev-parse HEAD))" >> $GITHUB_ENV
117+
echo "email=$(echo $(git log --pretty=format:"%ae" $commit_id))" >> $GITHUB_ENV
118+
119+
- name: Update Doc
120+
if: steps.DocUpdated.outputs.updateDoc
121+
run: |
122+
Green='0;32'
123+
NoColor='\033[0m'
124+
git config --global user.name "${{github.actor}}"
125+
git config --global user.email "${{env.email}}"
126+
git add .
127+
git commit -m "Update documentation"
128+
git push
129+
echo -e "🚀${Green} Hurrah! doc updated${NoColor}"
130+
131+
- name: Create Documentation Artifact
132+
uses: actions/upload-artifact@v2
133+
with:
134+
name: documentation-api
135+
path: talawa-api-docs
136+
137+
Copy-docs-to-talawa-docs:
138+
runs-on: ubuntu-latest
139+
if: github.ref == 'refs/heads/automated-docs'
140+
needs: Generate-Documentation
141+
steps:
142+
- uses: actions/checkout@v3
143+
- uses: dmnemec/[email protected]
144+
env:
145+
API_TOKEN_GITHUB: ${{ secrets.TALAWA_DOCS_SYNC }}
146+
with:
147+
source_file: 'talawa-api-docs/'
148+
destination_repo: 'PalisadoesFoundation/talawa-docs'
149+
destination_branch: 'testing-workflows'
150+
destination_folder: 'docs/'
151+
user_email: '${{env.email}}'
152+
user_name: '${{github.actor}}'
153+
commit_message: 'Talawa API docs updated'
154+

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ Go to `http://localhost:4000/voyager` after running the development server to ex
278278
279279
We use the [GraphQL Markdown](https://github.com/exogen/graphql-markdown) project to generate the documentation to describe the schema. To generate the same manually, you first need to start the development server locally with `npm run dev`, and then run the script `npm run generate:graphql-markdown`.
280280
281-
You can then view the [generated documentation here](./docs/Schema.md).
281+
You can then view the [generated documentation here](./talawa-api-docs/modules.md).
282282
283283
While we use a GitHub workflow to update ths schema documentation every time a PR is merged into the repository, it is highly advisable that if you making changes to the schema, then you should also update the schema documentation by the process described above.
284284

0 commit comments

Comments
 (0)