Skip to content

Commit 804ab52

Browse files
authored
[FEAT] add workflow for creating pull request inside ext repo (#3)
add a pull request into `lnbits/lnbits-extensions` repo with updated version
1 parent 0a1adde commit 804ab52

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

.github/workflows/release.yml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
tags:
44
- "v[0-9]+.[0-9]+.[0-9]+"
55
jobs:
6-
build:
6+
release:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v3
@@ -19,3 +19,45 @@ jobs:
1919
tag: ${{ github.ref_name }}
2020
run: |
2121
gh release create "$tag" --generate-notes
22+
23+
pullrequest:
24+
needs: [release]
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v3
28+
with:
29+
token: ${{ secrets.EXT_GITHUB }}
30+
repository: lnbits/lnbits-extensions
31+
path: './lnbits-extensions'
32+
33+
- name: setup git user
34+
run: |
35+
git config --global user.name "alan"
36+
git config --global user.email "alan@lnbits.com"
37+
38+
- name: Create pull request in extensions repo
39+
env:
40+
GH_TOKEN: ${{ secrets.EXT_GITHUB }}
41+
repo_name: "${{ github.event.repository.name }}"
42+
tag: "${{ github.ref_name }}"
43+
branch: "update-${{ github.event.repository.name }}"
44+
title: "[UPDATE] ${{ github.event.repository.name }} to ${{ github.ref_name }}"
45+
body: "https://github.com/lnbits/${{ github.event.repository.name }}/releases/${{ github.ref_name }}"
46+
archive: "https://github.com/lnbits/${{ github.event.repository.name }}/archive/refs/tags/${{ github.ref_name }}.zip"
47+
run: |
48+
cd lnbits-extensions
49+
git checkout -b $branch
50+
51+
# if there is another open PR
52+
git pull origin $branch || echo "branch does not exist"
53+
54+
sh util.sh update_extension $repo_name $tag
55+
56+
git add -A
57+
git commit -am "$title"
58+
git push origin $branch
59+
60+
# check if pr exists before creating it
61+
gh config set pager cat
62+
check=$(gh pr list -H $branch | wc -l)
63+
test $check -ne 0 || gh pr create --title "$title" --body "$body" --repo lnbits/lnbits-extensions

0 commit comments

Comments
 (0)