chore(element-tempaltes): Add github action for bumping element templ… #1
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: bump_element_template_docs_links | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [ opened, synchronize, reopened ] #TODO remove, just for testing | |
schedule: | |
- cron: "0 3 1 * *" # Runs monthly on the 1st at 03:00 UTC | |
jobs: | |
bump_element_template_docs_links: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Collect connector template links | |
run: | | |
chmod +x ./.github/scripts/sync-connector-template-links.sh | |
./.github/scripts/sync-connector-template-links.sh | |
shell: bash | |
- name: Clone camunda-docs repository | |
run: | | |
git clone https://github.com/camunda/camunda-docs.git | |
cd camunda-docs | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Compare files | |
id: check_diff | |
run: | | |
cd camunda-docs | |
if diff -q connectors-element-template-links.txt ../connector-element-template-links.txt > /dev/null; then | |
echo "No changes to commit." | |
echo "NO_CHANGES=true" >> $GITHUB_ENV | |
else | |
echo "Changes detected." | |
echo "NO_CHANGES=false" >> $GITHUB_ENV | |
fi | |
- name: Exit if no changes | |
if: env.NO_CHANGES == 'true' | |
run: echo "No changes detected, exiting successfully." | |
- name: Create branch, commit, and push changes | |
if: env.NO_CHANGES == 'false' | |
run: | | |
cd camunda-docs | |
BRANCH_NAME="update-connector-links-$(date +'%m-%Y')" | |
git checkout -b "$BRANCH_NAME" | |
mv ../connector-element-template-links.txt connectors-element-template-links.txt | |
git add connectors-element-template-links.txt | |
git commit -m "Update connector element template links for $(date +'%B %Y')" | |
git push origin "$BRANCH_NAME" | |
- name: Open a pull request in camunda-docs | |
if: env.NO_CHANGES == 'false' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.CAMUNDA_DOCS_PAT }} | |
repository: camunda/camunda-docs | |
branch: update-connector-links-$(date +'%m-%Y') | |
title: "Update Connector Element Template Links - $(date +'%B %Y')" | |
body: "This PR updates the connector element template links for $(date +'%B %Y')." | |
base: main |