This is a proof of concept. The current repo controls this repo's wiki page. GitHub Wikis are great. According to GitHub:
- README files are a quick and simple way for other users to learn more about your work.
- Wikis on GitHub help you present in-depth information about your project in a useful way.
- It’s a good idea to at least have a README on your project, because it’s the first thing many people will read when they first find your work.
Wikis can be forked and pulled down to edit locally, but the main problem, however, arises if you're working with a team. You can't submit a PR to your wiki.
This concept addresses that issue. Before beginning, you'll need to have signed up for circleci or have your organization sign up for circleci.
Steps to introduce into your project's wiki:
git clone <repo wiki url>
(see screenshot below)- Rename with <repo.wiki> to -wiki
- e.g.
mv example-project
toexample-project-wiki
- e.g.
- Create an empty repo in github (with the same name as you renamed above)
- Remove original repo origin
git remote remove origin
- Add the new origin
git remote add origin <new repo url>
- Generate a GitHub personal access token with write access to the project in the original repo. See GitHub Docs and screenshot below.
- Add your new repo as a circleci Project, in the circleci Dashboard. See circleci Docs
- In your circleci Project, add the following environment variables:
- GITHUB_EMAIL: The GitHub Account Email you created the Personal Access Token with.
- GITHUB_USERNAME: The GitHub Account Username you created the Personal Access Token with.
- GITHUB_API_KEY: The Personal Access Token from GitHub
- Add a
.circleci
directory and aconfig.yml
file in that directory locally. - Fill the config with following. (Note that any output generated by the command is redirected to
/dev/null
so that secrets never show up in the build log.). You can see this config as an example.version: 2.1 description: Automatically build and push to your GitHub Repo Wiki jobs: build: docker: - image: circleci/node steps: - checkout - run: name: Push Wiki To Project Wiki command: | git config user.email "${GITHUB_EMAIL}" git config user.name "${GITHUB_USERNAME}" git remote remove origin git remote add origin https://${GITHUB_API_KEY}@github.com/<github-username>/<original-repo-wiki.git> > /dev/null 2>&1 git push origin master > /dev/null 2>&1 workflows: main: jobs: - build: filters: branches: only: master
- Push to your new repo.
git add .
git commit -m "Add circleCI config"
git push -u origin master
Now, users can submit Pull Requests onto your new repo. If merged into master, changes will be pushed to the original repo's wiki. One thing to note, that if you rewrite history, this will fail. You can change:
git push origin master > /dev/null 2>&1
to
git push origin master -f > /dev/null 2>&1
in the config.yml
file to allow for rewriting history.
Clone Wiki:
CircleCI Add Project:
GitHub Personal Access Token: