forked from kus/cs2-modded-server
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- ADDED: Plugin version updater workflow for documentation
- Loading branch information
1 parent
bf441b8
commit 03c2a86
Showing
1 changed file
with
39 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Compare and Update Markdown Files | ||
|
||
on: | ||
push: | ||
paths: | ||
- '*.md' | ||
|
||
jobs: | ||
compare_and_update: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Compare files | ||
id: compare | ||
run: | | ||
# Get the content of the table starting with "Mod | Version | Developer | Why" from README.md | ||
readme_table=$(awk '/Mod \| Version \| Developer \| Why/ {p=1; print} p && /^\s*$/ {exit}' README.md) | ||
# Get the content of the corresponding table from /documentation/docs/Mods Included.md | ||
mod_included_table=$(awk '/Mod \| Version \| Developer \| Why/ {p=1; print} p && /^\s*$/ {exit}' documentation/docs/Mods\ Included.md) | ||
# Compare the tables | ||
if [[ "$readme_table" != "$mod_included_table" ]]; then | ||
echo "::set-output name=files_differ::true" | ||
else | ||
echo "::set-output name=files_differ::false" | ||
fi | ||
- name: Update files if needed | ||
if: steps.compare.outputs.files_differ == 'true' | ||
run: | | ||
# Update /documentation/docs/Mods Included.md with content of README.md | ||
cp README.md documentation/docs/Mods\ Included.md | ||
git add documentation/docs/Mods\ Included.md | ||
git commit -m "Update /documentation/docs/Mods Included.md with changes from README.md" | ||
git push |