Skip to content

Replace absolute links in changelog #179

Replace absolute links in changelog

Replace absolute links in changelog #179

name: Auto-open PRs for OptiView Player releases
on:
push:
branches:
- 'release/theoplayer-**'
jobs:
create-pr:
runs-on: ubuntu-latest
steps:
- name: Create app token
uses: actions/create-github-app-token@v3
id: app-token
with:
client-id: ${{ vars.THEOPLAYER_BOT_CLIENT_ID }}
private-key: ${{ secrets.THEOPLAYER_BOT_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v7
with:
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 1
- name: Configure Git user
# language=bash
run: |
git config user.name 'theoplayer-bot[bot]'
git config user.email '873105+theoplayer-bot[bot]@users.noreply.github.com'
- name: Check if pull request already exists
id: check_pr_exists
shell: bash
# language=bash
run: |
pr_count=$(gh pr list --base main --head $GITHUB_REF_NAME --state open --limit 1 --json number --jq length)
if ((pr_count > 0)); then
echo "exists=true" >> "$GITHUB_OUTPUT"
fi
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Replace absolute links in changelog
if: ${{ !steps.check_pr_exists.outputs.exists }}
shell: bash
# Replace absolute links to https://optiview.dolby.com/docs/ with relative links
# - Only change Markdown links, e.g. [title](url)
# - Don't change versioned links
# language=bash
run: |
sed -i -E 's|\(https://optiview.dolby.com/docs/(theoplayer/[^v])|\(/\1|g' theoplayer/changelog.md
if ! git diff --quiet; then
git add theoplayer/changelog.md
git commit -m "Replace absolute links in changelog"
git push origin
fi
- name: Create pull request
if: ${{ !steps.check_pr_exists.outputs.exists }}
shell: bash
# language=bash
run: |
theoplayer_version=$(<theoplayer/version.txt)
gh pr create \
--base main \
--head $GITHUB_REF \
--title "OptiView Player ${theoplayer_version}" \
--body "This PR contains the new documentation and API references for OptiView Player version ${theoplayer_version}"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}