mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-29 22:49:17 +00:00
Merge pull request #666 from btat/copy-action
Add action to apply updates in /docs to /versioned_docs/version-XYZ
This commit is contained in:
@@ -16,6 +16,62 @@ jobs:
|
|||||||
node-version: 18
|
node-version: 18
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
|
||||||
|
- name: Get changed files in /docs directory
|
||||||
|
id: changed-files-docs-dir
|
||||||
|
uses: tj-actions/changed-files@v36
|
||||||
|
with:
|
||||||
|
files: docs
|
||||||
|
|
||||||
|
- name: Get changed files in /versioned_docs/version-2.7/ directory
|
||||||
|
id: changed-files-versioned-docs-dir
|
||||||
|
uses: tj-actions/changed-files@v36
|
||||||
|
with:
|
||||||
|
files: ./versioned_docs/version-2.7/*
|
||||||
|
|
||||||
|
- name: List all changed in /docs
|
||||||
|
run: |
|
||||||
|
for file in ${{ steps.changed-files-docs-dir.outputs.all_changed_files }}; do
|
||||||
|
echo "$file was changed"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: List all changed in /versioned_docs
|
||||||
|
run: |
|
||||||
|
for file in ${{ steps.changed-files-versioned-docs-dir.outputs.all_changed_files }}; do
|
||||||
|
echo "$file was changed"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Copy changes (if any) from /docs to /versioned_docs/version-2.7
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
if: |
|
||||||
|
steps.changed-files-docs-dir.outputs.any_changed == 'true' &&
|
||||||
|
steps.changed-files-versioned-docs-dir.outputs.any_changed == 'false'
|
||||||
|
run: |
|
||||||
|
cp -r ./docs/* ./versioned_docs/version-2.7/
|
||||||
|
git config user.name "GitHub Actions Bot"
|
||||||
|
git config user.email "<>"
|
||||||
|
git config --global --add --bool push.autoSetupRemote true
|
||||||
|
gh pr checkout ${{ github.event.pull_request.number }}
|
||||||
|
git add ./versioned_docs/version-2.7/
|
||||||
|
git commit -m "Apply change(s) from /docs to /versioned_docs/version-2.7"
|
||||||
|
git push
|
||||||
|
|
||||||
|
- name: Copy changes (if any) from /versioned_docs/version-2.7 to /docs
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
if: |
|
||||||
|
steps.changed-files-docs-dir.outputs.any_changed == 'false' &&
|
||||||
|
steps.changed-files-versioned-docs-dir.outputs.any_changed == 'true'
|
||||||
|
run: |
|
||||||
|
cp -r ./versioned_docs/version-2.7/* ./docs/
|
||||||
|
git config user.name "GitHub Actions Bot"
|
||||||
|
git config user.email "<>"
|
||||||
|
git config --global --add --bool push.autoSetupRemote true
|
||||||
|
gh pr checkout ${{ github.event.pull_request.number }}
|
||||||
|
git add ./docs/
|
||||||
|
git commit -m "Apply change(s) from /versioned_docs/version-2.7 to /docs"
|
||||||
|
git push
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --frozen-lockfile
|
run: yarn install --frozen-lockfile
|
||||||
- name: Check links
|
- name: Check links
|
||||||
|
|||||||
Reference in New Issue
Block a user