Add documentation CI #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create documentation PR | |
on: | |
# Trigger the workflow on pull requests targeting the main branch | |
pull_request: | |
types: [assigned, unassigned, opened, reopened, synchronize, edited, labeled, unlabeled, edited, closed] | |
branches: | |
- main | |
jobs: | |
create_documentation_pr: | |
if: github.event.action != 'closed' | |
runs-on: ubuntu-latest | |
env: | |
DESTINATION_README_PATH: templates/documentation/sdks/vod | |
DESTINATION_README_FILE: apivideo-typescript-uploader.md | |
CLIENT_GENERATOR_FOLDER_PATH: .client-generator-repo | |
CLIENT_GENERATOR_REPOSITORY: apivideo/api.video-api-client-generator | |
steps: | |
- name: Check out current repository code | |
uses: actions/checkout@v2 | |
- name: Extract repository name | |
id: repo_name | |
run: echo "::set-output name=REPO_NAME::$(echo $GITHUB_REPOSITORY | sed 's|.*/||')" | |
shell: bash | |
- name: Create client generator repository folder | |
run: | | |
mkdir -p ${{ env.CLIENT_GENERATOR_FOLDER_PATH}}/${{ env.DESTINATION_README_PATH }} | |
- name: Checkout client generator repository | |
uses: actions/checkout@v2 | |
with: | |
repository: ${{ env.CLIENT_GENERATOR_REPOSITORY }} | |
token: ${{ secrets.PAT }} | |
path: ${{ env.CLIENT_GENERATOR_FOLDER_PATH }} | |
- name: Apply changes to the README file | |
uses: apivideo/api.video-modify-readme-for-doc-action@main | |
with: | |
source-file-path: "README.md" | |
destination-file-path: "${{ env.CLIENT_GENERATOR_FOLDER_PATH }}/${{ env.DESTINATION_README_PATH }}/${{ env.DESTINATION_README_FILE }}" | |
- name: Create the pull request on the client generator repository | |
uses: peter-evans/create-pull-request@v3 | |
id: cpr | |
with: | |
token: ${{ secrets.PAT }} | |
path: ${{ env.CLIENT_GENERATOR_FOLDER_PATH }} | |
commit-message: ${{ github.event.pull_request.title }} | |
committer: GitHub <[email protected]> | |
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
branch: ${{ github.event.pull_request.head.ref }} | |
title: "[SDK README - ${{ steps.repo_name.outputs.REPO_NAME }}] ${{ github.event.pull_request.title }}" | |
body: | | |
> ${{ github.event.pull_request.body }} | |
> Created by @${{ github.actor }} via ${{ github.event.pull_request.html_url }} | |
delete-branch: true | |
labels: ${{ join(github.event.pull_request.labels.*.name) }} | |
assignees: ${{ join(github.event.pull_request.assignees.*.login) }} |