Sync content with MapLibre website #2
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: Sync content with MapLibre website | |
on: | |
workflow_dispatch: | |
jobs: | |
create-pr-if-changed: | |
name: Create Pull Request if plugins list has changed | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout partial MapLibre repo | |
uses: actions/checkout@v4 | |
with: | |
repository: maplibre/maplibre-gl-js | |
path: partial-repo | |
sparse-checkout: docs/plugins.md | |
sparse-checkout-cone-mode: false | |
- name: checkout awesome MapLibre repo | |
uses: actions/checkout@v4 | |
with: | |
path: awesome | |
- name: generate plugins.md | |
run: node awesome/scripts/extract.mjs awesome/README.md awesome/scripts/plugins.template.md > plugins.new.md | |
- name: Check if plugins.md content has changed | |
id: check_file | |
run: | | |
if diff partial-repo/docs/plugins.md plugins.new.md > /dev/null; then | |
echo "FILE_UPDATED=0" >> $GITHUB_ENV | |
else | |
echo "FILE_UPDATED=1" >> $GITHUB_ENV | |
fi | |
- name: checkout complete MapLibre repo | |
if: ${{ env.FILE_UPDATED == '1' }} | |
uses: actions/checkout@v4 | |
with: | |
repository: maplibre/maplibre-gl-js | |
path: complete-repo | |
- name: copy updated plugins.md | |
if: ${{ env.FILE_UPDATED == '1' }} | |
run: | | |
cp plugins.new.md complete-repo/docs/plugins.md | |
- name: Create PR | |
if: ${{ env.FILE_UPDATED == '1' }} | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: complete-repo | |
branch: doc/sync | |
branch-suffix: timestamp | |
base: main | |
commit-message: "[doc] update plugins page" | |
title: "[doc] auto-sync plugins page from maplibre-gl" | |
body: "This pull request was automatically created by GitHub Actions." |