Skip to content
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

feat: docs automation for website #1082

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
bbf408f
add initial script
AnimeshKumar923 Feb 29, 2024
9982a1e
modify workflow code
AnimeshKumar923 Feb 29, 2024
98aed91
update `checkout` action version
AnimeshKumar923 Mar 1, 2024
ac843ae
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Mar 1, 2024
7275183
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Mar 2, 2024
34f07ff
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Mar 6, 2024
8ad48e3
fix: add script for `edit-page-config`
AnimeshKumar923 Mar 7, 2024
eb9ea89
chore: fix wrong indentation in the YAML file
AnimeshKumar923 Mar 7, 2024
2e60372
Merge branch 'master' into docs-automation-for-website
quetzalliwrites Mar 12, 2024
5605600
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Mar 13, 2024
2edb616
update `checkSlug`
AnimeshKumar923 Mar 14, 2024
61eb31d
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Mar 18, 2024
b6f695b
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Mar 18, 2024
373dc55
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Mar 19, 2024
4aab3d6
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Mar 24, 2024
4f226eb
Merge branch 'master' into docs-automation-for-website
quetzalliwrites Mar 25, 2024
088d4d9
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Mar 26, 2024
993daa4
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Mar 27, 2024
6cea213
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Mar 28, 2024
77c2b4f
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Apr 3, 2024
bf5ddf0
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Apr 5, 2024
768c2b2
Update script
AnimeshKumar923 Apr 5, 2024
a70dab5
Update script
AnimeshKumar923 Apr 5, 2024
7982022
Update script
AnimeshKumar923 Apr 5, 2024
7e3d25f
Update script
AnimeshKumar923 Apr 5, 2024
cd6a986
chore: fix indentation
AnimeshKumar923 Apr 5, 2024
e8794d4
chore: small indent fix
AnimeshKumar923 Apr 5, 2024
42bf6d7
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Apr 9, 2024
4f89550
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Jun 5, 2024
89b314d
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Jun 14, 2024
95e5cc9
Merge branch 'master' into docs-automation-for-website
AnimeshKumar923 Jul 6, 2024
04a47d4
Merge branch 'master' into docs-automation-for-website
thulieblack Oct 21, 2024
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
87 changes: 87 additions & 0 deletions .github/workflows/update-docs-in-website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Update latest Community documentation in the website

on:
push:
branches:
- 'master'
paths:
- 'docs/*.md'

jobs:
Make-PR:
name: Make PR on website repository with updated latest Community documentation
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Checkout Current repository
uses: actions/checkout@v4
with:
path: community
- name: Checkout Another repository
uses: actions/checkout@v4
with:
repository: asyncapi/website
path: website
token: ${{ env.GITHUB_TOKEN }}
- name: Config git
run: |
git config --global user.name asyncapi-bot
git config --global user.email [email protected]
- name: Create branch
working-directory: ./website
run: |
git checkout -b update-community-docs-${{ github.sha }}
- name: Update edit-page-config.json
uses: actions/github-script@v4
with:
script: |
const fs = require('fs').promises;
const configPath = './website/config/edit-page-config.json';
const configData = require(configPath);
const docsDir = 'community/docs';

async function readDirectories(dirPath) {
const entries = await fs.readdir(dirPath, { withFileTypes: true });
const subdirectories = entries.filter(entry => entry.isDirectory()).map(entry => entry.name);
return subdirectories;
}

async function updateConfigData() {
const subfolders = await readDirectories(docsDir);

for (const subfolder of subfolders) {
const checkSlug = `community/${subfolder}`;
const slug = {
"value": checkSlug,
"href": `https://github.com/asyncapi/community/tree/master/docs/${subfolder}`
};

const entryExists = configData.some(entry => entry.value === checkSlug);
if (!entryExists) {
configData.push(slug);
}
}

await fs.writeFile(configPath, JSON.stringify(configData, null, 2));
}
updateConfigData();

- name: Copy community folder from Current Repo to Another
working-directory: ./website
run: |
rm -r ./pages/docs/community/onboarding-guide
mkdir -p ./pages/docs/community/onboarding-guide
rm ../community/docs/README.md
printf "%s\ntitle: Onboarding guide\nweight: 10\n%s" "---" "---"> ../community/docs/onboarding-guide/_section.md
mv ../community/docs/onboarding-guide/*.md ./pages/docs/community/onboarding-guide
- name: Commit and push
working-directory: ./website
run: |
git add .
git commit -m "docs(community): update latest community docs"
git push https://${{ env.GITHUB_TOKEN }}@github.com/asyncapi/website
- name: Create PR
working-directory: ./website
run: |
gh pr create --title "docs(community): update latest community documentation" --body "Updated community documentation is available and this PR introduces update to community folder on the website" --head "update-community-docs-${{ github.sha }}"
Loading