Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-update plugin docs versions #3298

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .github/workflows/plugindocs-lint.yml

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/plugindocs-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Update Plugin Docs
on:
schedule:
- cron: '0 9 * * *'
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
update-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Check for updates
id: check
run: |
updates_needed=false
updates_text=""
build_file=$(cat docs/BUILD)

PLUGINS=("python" "java" "go" "cc" "shell" "go-proto" "proto")
URL_PREFIX="https://github.com/please-build/"
for plugin in "${PLUGINS[@]}"; do
latest=$(git ls-remote --tags --sort=version:refname "${URL_PREFIX}${plugin}-rules.git" | sed 's/.*\///' | sed '/^v[0-9]\+\.[0-9]\+\.[0-9]\+$/!d' | tail -n 1)
if [ -z "$latest" ]; then
echo "No tags found for ${plugin}"
exit 1
fi

docs_version=$(./pleasew query print //docs/... --include "${plugin}"_plugin_docs* | grep labels | cut -d: -f2 | cut -d\' -f1)
if [ -z "$docs_version" ]; then
echo "No docs found for ${plugin}"
exit 1
fi

if [ "$latest" != "$docs_version" ]; then
updates_needed=true
updates_text="${updates_text}${plugin}: ${docs_version} -> ${latest}\n"
build_file=$(echo "$build_file" | sed "s/\"$plugin\": \"$docs_version\"/\"$plugin\": \"$latest\"/")
fi
done

if [ "$updates_needed" = true ]; then
echo "$build_file" > docs/BUILD
fi

echo "UPDATES_NEEDED=${updates_needed}" >> "$GITHUB_OUTPUT"
echo "UPDATES_TEXT=${updates_text}" >> "$GITHUB_OUTPUT"

- name: Create Pull Request
if: steps.check.outputs.UPDATES_NEEDED == 'true'
uses: peter-evans/create-pull-request@v7
with:
commit-message: "docs: Update plugin documentation versions"
title: "docs: Update plugin documentation versions"
body: |
Automated PR to update plugin documentation versions:

${{ steps.check.outputs.UPDATES_TEXT }}
branch: update-plugin-docs
delete-branch: true
34 changes: 0 additions & 34 deletions docs/plugins/lint_plugin_docs.sh

This file was deleted.

Loading