Skip to content
Closed

test #119

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
40 changes: 24 additions & 16 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
name: Pull Request Tests
name: Documentation

on:
push:
tags:
- '*'
branches:
- main
- release/*
- feature/*
on: [
pull_request
]

permissions:
contents: write
pull-requests: write

jobs:
docs-build:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
build:
if: ${{ !contains(github.event.pull_request.title, '[skip ci]') && !github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -59,13 +55,25 @@ jobs:
# This must be our very final step to ensure that it runs only on condition of
# success of all previous steps. A pushed commit will not trigger the re-running
# of this workflow.
- name: Commit and push documentation changes
- name: Open documentation PR
if: steps.check-docs.outputs.changed == 'true'
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git add docs/.
git commit -am "Automated reference documentation update for PR ${{ github.event.number }} [skip ci]"
git push

DOCS_BRANCH="docs/automated-pr-${{ github.event.number }}"

git checkout -b "$DOCS_BRANCH"
git commit -m "Automated reference documentation update for PR ${{ github.event.number }} [skip ci]"
git push origin "$DOCS_BRANCH" --force

# Create a PR only if one is not already open for this branch
if ! gh pr list --head "$DOCS_BRANCH" --json number --jq '.[0].number' | grep -q .; then
gh pr create \
--title "Automated documentation update for PR #${{ github.event.number }} [skip ci]" \
--body "Automated documentation update generated by CI for PR #${{ github.event.number }}." \
--base "${{ github.head_ref }}" \
--head "$DOCS_BRANCH"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading