update-docs #9
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: Update Docs | |
on: | |
repository_dispatch: | |
types: [update-docs] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.client_payload.sha }} | |
- name: Update the docs | |
run: | | |
python3 -m venv /tmp/venv | |
/tmp/venv/bin/pip install --upgrade pip | |
/tmp/venv/bin/pip install -r bin/requirements.txt | |
echo '${{ toJson(github.event.client_payload) }}' > /tmp/payload.json | |
node -e "const fs = require('fs');\ | |
const payloadContent = fs.readFileSync('/tmp/payload.json', 'utf8');\ | |
const payloadJSON = JSON.parse(payloadContent);\ | |
const formattedJSON = JSON.stringify(payloadJSON, null, 2);\ | |
fs.writeFileSync('/tmp/venv/bin/changes.json', formattedJSON);" | |
/tmp/venv/bin/python bin/update-docs.py | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
delete-branch: true | |
commit-message: Updated timewarrior docs | |
author: "Timewarrior Docs Bot <timew-docs-bot@users.noreply.github.com>" | |
title: Updated timewarrior docs | |
body: | | |
- Updated timewarrior docs | |
Auto-generated by [create-pull-request][1] | |
[1]: https://github.com/peter-evans/create-pull-request | |
branch: update-docs | |
- name: Merge Pull Request | |
if: "${{ steps.cpr.outputs.pull-request-number != '' }}" | |
uses: juliangruber/merge-pull-request-action@v1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
number: ${{ steps.cpr.outputs.pull-request-number }} | |
method: merge |