-
Notifications
You must be signed in to change notification settings - Fork 2
46 lines (46 loc) · 1.6 KB
/
theoplayer-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Auto-open PRs for THEOplayer releases
on:
push:
branches:
- 'release/theoplayer-**'
jobs:
create-pr:
runs-on: ubuntu-latest
steps:
- name: Create app token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.THEOPLAYER_BOT_APP_ID }}
private-key: ${{ secrets.THEOPLAYER_BOT_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 1
- name: Configure Git user
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
run: |
pr_count=$(gh pr list --base main --head $GITHUB_REF --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: Create pull request
if: ${{ !steps.check_pr_exists.outputs.exists }}
shell: bash
run: |
theoplayer_version=$(<theoplayer/version.txt)
gh pr create \
--base main \
--head $GITHUB_REF \
--title "THEOplayer ${theoplayer_version}" \
--body "This PR contains the new documentation and API references for THEOplayer version ${theoplayer_version}"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}