Skip to content

Commit

Permalink
chore(element-tempaltes): Add github action fro bumping element templ…
Browse files Browse the repository at this point in the history
…ate docs links
  • Loading branch information
ztefanie committed Feb 27, 2025
1 parent 937826b commit 8cc5a2f
Show file tree
Hide file tree
Showing 3 changed files with 225 additions and 0 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/BUMP_ELEMENT_TEMPLATE_DOCS_LINKS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
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

permissions:
contents: write # Allows pushing changes to the target repo
pull-requests: write # Allows creating a PR

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/workflows/scripts/collect_all_element_template_docs_links.sh
./.github/workflows/scripts/collect_all_element_template_docs_links.sh
shell: bash

- name: Import Secrets
id: vault-secrets
uses: hashicorp/vault-action@v3.1.0
with:
url: ${{ secrets.VAULT_ADDR }}
method: approle
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID}}
secrets: |
secret/data/products/connectors/ci/common GITHUB_APP_ID;
secret/data/products/connectors/ci/common GITHUB_APP_PRIVATE_KEY;
- name: Generate a GitHub token for connectors
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ steps.vault-secrets.outputs.GITHUB_APP_ID }}
private-key: ${{ steps.vault-secrets.outputs.GITHUB_APP_PRIVATE_KEY }}
owner: camunda
repositories: camunda-docs

- name: Checkout camunda-docs repo
uses: actions/checkout@v4
with:
repository: camunda/camunda-docs
token: ${{ steps.app-token.outputs.token }}
path: camunda-docs

- name: Compare files
id: check_diff
run: |
cd camunda-docs
if diff -q connectors-element-template-links.txt ../connectors-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."
exit 0
- name: Create branch, commit, and push changes
if: env.NO_CHANGES == 'false'
run: |
cd camunda-docs
git config --local user.email "github-actions@github.com"
git config --local user.name "connectors-automation"
BRANCH_NAME="update-connector-links-$(date +'%m-%Y')"
git checkout -b "$BRANCH_NAME"
mv ../connectors-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')"
# Authenticate Git using App Token
git remote set-url origin https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/camunda/camunda-docs.git
git push --set-upstream origin "$BRANCH_NAME"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}

- name: Create Pull Request in anderes Repo
run: |
BRANCH_NAME="update-connector-links-$(date +'%m-%Y')"
git checkout -b "$BRANCH_NAME"
gh pr create \
--base main \
--title "Update Connector Element Template Links - $(date +'%B %Y')" \
--body "This PR updates the connector element template links for $(date +'%B %Y')." \
--reviewer camunda/tech-writers
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash
set -e

DOCUSAURUS_BASE_URL="https://docs.camunda.io/"
GITHUB_FILE_URL="https://raw.githubusercontent.com/camunda/camunda-docs/d50f0a316cc629c43b2038d1a814a70dbac17add/connectors-element-template-links.txt" #TODO adjust this to main once merged
DOCS_REPO_LINK_FILE="connector-element-template-links-download.txt"
CURRENT_LINK_FILE="connector-element-template-links-current.txt"
NEW_LINK_FILE="connectors-element-template-links.txt"

# Clear files
: > "$DOCS_REPO_LINK_FILE"
: > "$CURRENT_LINK_FILE"
: > "$NEW_LINK_FILE"

echo "Downloading existing links file from docs repo..."
curl -sL "$GITHUB_FILE_URL" | grep "^$DOCUSAURUS_BASE_URL" > "$DOCS_REPO_LINK_FILE"


echo "Extracting links from connectors repo..."

extract_links_from_file() {
local file_path="$1"
grep -oE "\"$DOCUSAURUS_BASE_URL[^\"]+\"" "$file_path" | sed -E "s|\"||g; s|[\\/]$||g"
}

# Find all JSON files in "element-templates" directories, extract documentation links,
find . -type d -name "element-templates" | while read -r dir; do
find "$dir" -type f -name "*.json" | while read -r file; do
extract_links_from_file "$file"
done
done | sort -u >> "$CURRENT_LINK_FILE" # Sort & remove duplicates before writing


echo "Merging links from docs file and new file..."
cat "$CURRENT_LINK_FILE" "$DOCS_REPO_LINK_FILE" | sort -u > "$NEW_LINK_FILE"

echo -e "# This file contains links from connectors element templates to the documentation
# This file is used to check that we don't accidentally break these links\n\n$(cat "$NEW_LINK_FILE")" > "$NEW_LINK_FILE"

rm $DOCS_REPO_LINK_FILE
rm $CURRENT_LINK_FILE

echo "Script completed successfully."
exit 0



78 changes: 78 additions & 0 deletions connectors-element-template-links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# This file contains links from connectors element templates to the documentation
# This file is used to check that we don't accidentally break these links

https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/upload-document-alpha/
https://docs.camunda.io/docs/apis-tools/operate-api/specifications/search
https://docs.camunda.io/docs/apis-tools/operate-api/specifications/search/
https://docs.camunda.io/docs/components/concepts/messages/#message-correlation-overview
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/amazon-bedrock
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/amazon-dynamodb
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/amazon-dynamodb/
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/amazon-eventbridge/?awseventbridge=inbound
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/amazon-eventbridge/?awseventbridge=outbound
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/amazon-s3
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/amazon-sns/?amazonsns=inbound
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/amazon-sns/?amazonsns=outbound
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/amazon-sqs/?amazonsqs=inbound
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/amazon-sqs/?amazonsqs=outbound
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/asana
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/automation-anywhere
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/automation-anywhere/
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/aws-lambda
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/aws-lambda/#aws-authentication-types
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/azure-open-ai
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/blueprism
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/box
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/easy-post
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/email
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/github/?github=inbound
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/github/?github=outbound
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/googledrive
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/google-gemini
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/google-maps-platform
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/google-sheets
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/google-sheets/#add-values-to-spreadsheet
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/google-sheets/#create-empty-column-or-row
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/google-sheets/#create-row
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/google-sheets/#how-can-i-define-which-column-will-be-deleted
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/google-sheets/#what-is-a-row-index
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/google-sheets/#what-is-a-worksheet-index
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/hugging-face
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/kafka/?kafka=inbound
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/kafka/?kafka=outbound
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/microsoft-o365-mail
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/microsoft-teams
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/openai
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/operate
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/rabbitmq/?rabbitmq=inbound
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/rabbitmq/?rabbitmq=outbound
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/rabbitmq/?rabbitmq=outbound#routing-data
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/salesforce
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/sendgrid
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/slack/?slack=inbound
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/slack/?slack=outbound
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/twilio/?twilio=inbound
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/twilio/?twilio=outbound
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/uipath
https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/whatsapp
https://docs.camunda.io/docs/components/connectors/protocol/graphql
https://docs.camunda.io/docs/components/connectors/protocol/graphql/#querymutation
https://docs.camunda.io/docs/components/connectors/protocol/http-webhook
https://docs.camunda.io/docs/components/connectors/protocol/polling
https://docs.camunda.io/docs/components/connectors/protocol/rest
https://docs.camunda.io/docs/components/connectors/protocol/soap
https://docs.camunda.io/docs/components/connectors/use-connectors/
https://docs.camunda.io/docs/components/connectors/use-connectors/#bpmn-errors
https://docs.camunda.io/docs/components/connectors/use-connectors/#result-expression
https://docs.camunda.io/docs/components/connectors/use-connectors/#result-variable
https://docs.camunda.io/docs/components/modeler/bpmn/none-events
https://docs.camunda.io/docs/guides
https://docs.camunda.io/docs/guides/setup-client-connection-credentials
https://docs.camunda.io/docs/next/apis-tools/camunda-api-rest/specifications/create-document-link/
https://docs.camunda.io/docs/next/components/connectors/out-of-the-box-connectors/amazon-comprehend
https://docs.camunda.io/docs/next/components/connectors/out-of-the-box-connectors/amazon-sagemaker
https://docs.camunda.io/docs/next/components/connectors/out-of-the-box-connectors/amazon-textract
https://docs.camunda.io/docs/next/components/connectors/out-of-the-box-connectors/sql
https://docs.camunda.io/docs/next/components/connectors/out-of-the-box-connectors/sql/#connection
https://docs.camunda.io/docs/next/components/connectors/out-of-the-box-connectors/sql/#uri-connection
https://docs.camunda.io/docs/next/components/connectors/out-of-the-box-connectors/sql/#variables

0 comments on commit 8cc5a2f

Please sign in to comment.