From d52f11e72895232821d1f47858f6403f42695786 Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Fri, 5 Dec 2025 15:40:59 +0300 Subject: [PATCH] Update `marketplace-upload.yml` for all module repositories --- .../update-marketplace-workflows.yml | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/update-marketplace-workflows.yml diff --git a/.github/workflows/update-marketplace-workflows.yml b/.github/workflows/update-marketplace-workflows.yml new file mode 100644 index 0000000..1c5ae69 --- /dev/null +++ b/.github/workflows/update-marketplace-workflows.yml @@ -0,0 +1,86 @@ +name: Update Marketplace Workflows + +on: + workflow_dispatch: + +jobs: + update: + runs-on: ubuntu-latest + + steps: + - name: Checkout admin repo + uses: actions/checkout@v4 + + - name: Configure SSH + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_KEY }} + + - name: Install tools + run: | + sudo apt-get update + sudo apt-get install -y git jq + + - name: Fetch list of repos in humhub org + run: | + curl -s -H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" \ + https://api.github.com/orgs/humhub/repos?per_page=200 \ + | jq -r '.[].ssh_url' > repos.txt + + - name: Process repositories and create PRs + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + NEW_CONTENT=$(cat << 'EOF' +on: + push: + tags: + - 'v*' + +name: Upload to HumHub Marketplace + +jobs: + build: + uses: humhub/module-coding-standards/.github/workflows/marketplace-upload.yml@main + secrets: inherit +EOF +) + + while read -r REPO_URL; do + echo "Processing $REPO_URL" + REPO_NAME=$(basename "$REPO_URL" .git) + + git clone "$REPO_URL" + cd "$REPO_NAME" || exit + + FILE=".github/workflows/marketplace-upload.yml" + BRANCH="update-marketplace-workflow" + + if [ -f "$FILE" ]; then + if grep -q "uses: humhub/actions/.github/workflows/module-marketplace-upload.yml@main" "$FILE"; then + echo " Updating file and creating PR..." + + git checkout -b "$BRANCH" + + echo "$NEW_CONTENT" > "$FILE" + + git add "$FILE" + git commit -m "Update marketplace-upload.yml to new standard workflow" || true + git push -u origin "$BRANCH" || true + + # Create PR + gh pr create \ + --title "Update marketplace-upload.yml to new standard workflow" \ + --body "This PR updates the marketplace upload workflow to the new standard version." \ + --repo "humhub/$REPO_NAME" || true + + else + echo " File exists but old string not found — skipping" + fi + else + echo " No marketplace-upload.yml found — skipping" + fi + + cd .. + rm -rf "$REPO_NAME" + done < repos.txt