doc-sync #8
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
name: doc-sync | |
on: | |
repository_dispatch: | |
types: [doc-sync] | |
env: | |
doc_repo: "${{ github.event.client_payload.repo }}" | |
doc_sha: "${{ github.event.client_payload.sha }}" | |
jobs: | |
doc-sync: | |
if: ${{ github.event.client_payload.ref == 'refs/heads/master' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.GH_ACTIONS_DAVIDEPUCCI }} | |
- name: Setup repository | |
run: | | |
git config user.email "automata@davidepucci.it" | |
git config user.name "Automata" | |
- name: Sync doc to dispatched sha | |
run: | | |
doc_name="$(awk -F'/' '{print $2}' <<< "${doc_repo}")" | |
doc_module="src/docs/${doc_name}" | |
git submodule update --init "${doc_module}" | |
git --git-dir="${doc_module}/.git" checkout "${doc_sha}" | |
git commit -m "docs(${doc_name}): sync (${doc_repo}@$(cut -c-7 <<< "${doc_sha}"))" "${doc_module}" | |
- name: Push repository | |
run: git push |