Skip to content

Add new workflow for detecting changes in dot org #20

Add new workflow for detecting changes in dot org

Add new workflow for detecting changes in dot org #20

Workflow file for this run

name: Detect changes in documentation within nginx/nginx.org
on:
pull_request:
# workflow_dispatch:
# schedule:
# - cron: "0 */23 * * *"
permissions:
pull-requests: write
jobs:
detect-changes:
name: Detect changes in 'en' docs of nginx/nginx.org
runs-on: ubuntu-latest
outputs:
IS_CHANGES_DETECTED: ${{ steps.check_changes.outputs.changed }}
steps:
- name: Clone the nginx/nginx-org repository
run: |
git clone --depth=2 https://github.com/nginx/nginx.org.git dot-org-repo
- name: Check for changes in xml/en folder
id: check_changes
run: |
cd dot-org-repo
commit1=$(git rev-parse HEAD)
commit2=$(git rev-parse HEAD^)
if git diff --name-only $commit2 $commit1 | grep '^xml/en/'; then
echo "Changes detected in /en"
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "No changes in /en"
echo "changed=false" >> $GITHUB_OUTPUT
fi
create-PR:
name: Create PR in documentation repository
if: needs.detect-changes.outputs.IS_CHANGES_DETECTED
runs-on: ubuntu-latest
steps:
- name: Create a new branch
run: gh pr create -B base_branch -H branch_to_merge --title 'NGINX Plus - Module Ref - Update content for content/nginx due to detected changes' --body '### Proposed Changes\nUpdated NGINX Plus docs'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}