-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit a3878ed Author: helderbetiol <[email protected]> Date: Wed Feb 28 10:51:13 2024 +0100 Update wiki-conflicts.yml commit 4dd2453 Author: helderbetiol <[email protected]> Date: Wed Feb 28 10:47:41 2024 +0100 Update wiki-conflicts.yml commit b242b2b Author: helderbetiol <[email protected]> Date: Wed Feb 28 10:34:12 2024 +0100 Update wiki-conflicts.yml
- Loading branch information
1 parent
b679439
commit e539574
Showing
1 changed file
with
44 additions
and
37 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 |
---|---|---|
@@ -1,41 +1,48 @@ | ||
name: 📚 Verify conflicts in Wiki | ||
name: Documentation | ||
|
||
# Trigger this action only if there are changes pushed to the wiki/** directory in a pull request | ||
on: | ||
pull_request: | ||
branches: [ "main" ] | ||
paths: | ||
- wiki/** | ||
push: | ||
branches: | ||
- fix396-wiki-conflicts | ||
# paths: | ||
# - "docs/**" | ||
# repository_dispatch: | ||
# types: [docs] | ||
gollum: | ||
|
||
jobs: | ||
verify_conflicts_wiki: | ||
name: Verify conflicts in wiki | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
env: | ||
GIT_AUTHOR_NAME: Actionbot | ||
GIT_AUTHOR_EMAIL: [email protected] | ||
|
||
# 1. Create folder named `tmp_wiki` | ||
# 2. Initialize Git | ||
# 3. Pull old Wiki content | ||
- name: Pull content from wiki | ||
run: | | ||
mkdir tmp_wiki | ||
cd tmp_wiki | ||
git init | ||
git pull https://github.com/ditrit/OGrEE-Core.wiki.git | ||
- name: Setup main branch locally without switching current branch | ||
run: git fetch origin main:main | ||
# 4. Try to apply all the changes to the wiki | ||
- name: Get changes | ||
run: git diff --no-ext-diff main:wiki/ HEAD:wiki/ > wiki_diff | ||
- name: Prepare changes | ||
run: | | ||
sed -i "s/a\/wiki/a/" wiki_diff | ||
sed -i "s/b\/wiki/b/" wiki_diff | ||
- name: Apply changes | ||
run: | | ||
cd tmp_wiki | ||
git apply --ignore-space-change ../wiki_diff | ||
jobs: | ||
job-sync-docs-to-wiki: | ||
runs-on: ubuntu-latest | ||
if: github.event_name != 'gollum' | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
- name: Sync docs to wiki | ||
uses: newrelic/wiki-sync-action@main | ||
with: | ||
source: wiki/ | ||
destination: wiki | ||
token: ${{ secrets.WIKI_ACTION_TOKEN }} | ||
|
||
job-sync-wiki-to-docs: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'gollum' | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.WIKI_ACTION_TOKEN }} # allows us to push back to repo | ||
ref: fix396-wiki-conflicts | ||
- name: Sync Wiki to Docs | ||
uses: newrelic/wiki-sync-action@main | ||
with: | ||
source: wiki | ||
destination: wiki/ | ||
token: ${{ secrets.WIKI_ACTION_TOKEN }} | ||
# gitAuthorName: ${{ env.GIT_AUTHOR_NAME }} | ||
# gitAuthorEmail: ${{ env.GIT_AUTHOR_EMAIL }} | ||
branch: fix396-wiki-conflicts # since default branch is develop in this example |