Document #40
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: Documents | |
on: | |
workflow_dispatch: | |
repository_dispatch: | |
types: | |
- Document | |
env: | |
GH_TOKEN: ${{ github.token }} | |
jobs: | |
update-document: | |
runs-on: ubuntu-latest | |
name: Create pull request | |
if: github.event.action == 'Document' | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Create pull request | |
run: | | |
doc_branch=automation/task/update-rfw-documents | |
echo "Create pull request to merge documents" | |
pr_exists=$(gh pr list --state open | grep -qw "Auto-updated documents" && echo "found" || echo "not found") | |
if [ "$pr_exists" == "not found" ]; then | |
# Pull request not exist | |
echo "Pull request not found. Creating a new one..." | |
gh pr create \ | |
--base develop --head $doc_branch \ | |
--title "Auto-updated documents" \ | |
--body "This PR was automatically generated by GitHub Actions to update documents" \ | |
--assignee test-fullautomation \ | |
--reviewer huavanthong \ | |
--reviewer holque | |
else | |
echo "Pull request already exists. Skipping..." | |
fi |