Skip to content

feat(docs): Add workflow to automate docs and license generation #9

feat(docs): Add workflow to automate docs and license generation

feat(docs): Add workflow to automate docs and license generation #9

# Copyright (c) Codesphere Inc.
# SPDX-License-Identifier: Apache-2.0
name: 'Auto-Update Docs & Licenses'
permissions:
contents: write
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- main
jobs:
update-files:
# skip runs triggered by the bot's own commit to avoid loops
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
# on push to main, use main; on PR, check out the PR head
ref: ${{ github.event.pull_request.head.ref || github.ref }}
- name: Update docs & licenses
run: |
./hack/update-docs-and-licenses.sh
- name: Commit and push auto-generated changes
run: |
if [ -n "$(git status --porcelain)" ]; then
# Configure git user for the commit
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Add all changes
git add .
# Create a new commit WITH signoff for DCO
git commit --signoff -m "chore(docs): Auto-update docs and licenses"
# Push the new commit to the branch
git push
else
echo "No changes to commit."
fi