Skip to content

Commit

Permalink
Merge branch 'main' into oxve-patch-8
Browse files Browse the repository at this point in the history
  • Loading branch information
oxve committed Jun 20, 2024
2 parents 576c2f2 + b020046 commit e525fa0
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/actions/pre_commit/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ inputs:
runs:
using: "composite"
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install Pip Packages
shell: bash
run: pip install --require-hashes --no-deps -r ${GITHUB_WORKSPACE}/precommit_hooks/requirements.txt
- run: pre-commit run --show-diff-on-failure --color=always --from-ref ${{ inputs.base_ref }} --to-ref HEAD
shell: bash
env:
Expand Down
85 changes: 85 additions & 0 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Cobalt Documentation

on:
pull_request_target:
types:
- closed
workflow_dispatch:

concurrency:
group: '${{ github.workflow }}-${{ github.event_name }} @ ${{ github.event.pull_request.number || github.sha }}'
cancel-in-progress: true

permissions: {}

jobs:
developer-docs:
if: github.actor != 'cobalt-github-releaser-bot'
name: Generate Docs
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: DEBUG
run: echo ${{ github }}
shell: bash
- name: Checkout
uses: kaidokert/[email protected]
with:
ref: ${{ github.base_ref }}
fetch-depth: 0
persist-credentials: false
- name: Docker Build
run: docker build -t docsite --build-arg UID=$(id -u) --build-arg GID=$(id -g) cobalt/site/docker
shell: bash
- name: Docker Run
run: docker run --mount type=bind,source=$(pwd),target=/code docsite
shell: bash
- name: Stage docs for pre-commit
run: git add -A cobalt/site/docs
shell: bash
- name: Run pre-commit
uses: ./.github/actions/pre_commit
with:
base_ref: ${{ github.event.pull_request.base.sha || github.event.before }}
- name: Set env variables (PR)
if: github.event_name == 'pull_request'
run: |
branch="doc-${{ github.event.pull_request.number }}"
echo "BRANCH=${branch}" >> ${GITHUB_ENV}
reviewers="${{ github.event.pull_request.user.login }}"
echo "REVIEWERS=${reviewers}" >> ${GITHUB_ENV}
title="Documentation changes for #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}"
echo "TITLE=${title}" >> ${GITHUB_ENV}
body=$(cat <<-EOF
Refer to the original PR: https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}
${{ github.event.pull_request.body }}
EOF
)
echo "BODY=${body}" >> ${GITHUB_ENV}
- name: Set env variables (postsubmit)
if: github.event_name == 'pull_request'
run: |
branch="doc-${{ github.run_id }}"
echo "BRANCH=${branch}" >> ${GITHUB_ENV}
reviewers="${{ github.actor }}"
echo "REVIEWERS=${reviewers}" >> ${GITHUB_ENV}
title="Documentation changes for ${{ github.base_ref }}"
echo "TITLE=${title}" >> ${GITHUB_ENV}
echo "BODY=" >> ${GITHUB_ENV}
- name: Create Pull Request
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04 # v4.2.3
with:
token: ${{ secrets.CHERRY_PICK_TOKEN }}
base: ${{ github.base_ref }}
branch: ${{ env.BRANCH }}
reviewers: ${{ env.REVIEWERS }}
committer: GitHub Release Automation <[email protected]>
title: ${{ env.TITLE }}
body: ${{ env.BODY }}

0 comments on commit e525fa0

Please sign in to comment.