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

[CI] Synchronize CFn resource types in the wiki #108

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Changes from all commits
Commits
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
38 changes: 38 additions & 0 deletions .github/workflows/wiki_sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: sync wiki

on:
push:
branches: main

jobs:
update-wiki:
runs-on: ubuntu-latest

steps:
- name: Checkout main
uses: actions/checkout@v3

- name: Checkout wiki
uses: actions/checkout@v3
with:
repository: "${{ github.repository }}.wiki"
path: .wiki

- name: Update wiki pages
run: (cd tools && ./generate-md-table-from-mappings) > .wiki/CloudFormation-Resource-Type-Compatibility.md

- name: Staging the changes
working-directory: .wiki
id: staging
run: |
git add .
echo "CHANGES=$(git diff --staged --name-only | wc -l)" >> $GITHUB_OUTPUT

- name: Publish wiki
working-directory: .wiki
if: steps.staging.outputs.CHANGES > 0
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git commit -m "Automatic updates via GitHub action[.github/workflows/wiki_sync.yaml]"
git push
15 changes: 14 additions & 1 deletion tools/generate-md-table-from-mappings
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/zsh
#!/bin/bash
echo "# Service Icons"
echo "| Resource Type | Icon title |"
echo "| --- | --- |"
cat ./make-definition-from-pptx-mappings | cut -d',' -f1 | cut -d':' -f1,2,3 | sort | uniq | while read line
@@ -8,3 +9,15 @@ do
echo "$title\` |"
[[ $? != 0 ]] && echo "$line"
done

echo "# Resource Icons"
echo "| Resource Type | Icon title |"
echo "| --- | --- |"
cat ./make-definition-from-pptx-mappings | grep "[A-z0-9]*::[A-z0-9]*::[A-z0-9]*" | cut -d',' -f1 | sort | uniq | while read line
do
echo -n "| \`$line\` | \`"
title=$(cat ./make-definition-from-pptx-mappings | grep "$line," | cut -d',' -f2 | tr -d '[:cntrl:]')
echo "$title\` |"
[[ $? != 0 ]] && echo "$line"
done
exit 0