Skip to content

Commit c6fc7bf

Browse files
committed
chore: add release-pr action
1 parent 3261da0 commit c6fc7bf

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

action/release-pr/action.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Open release PR
2+
description: Commit prepared release files and open a pull request
3+
4+
inputs:
5+
app-slug:
6+
description: Slug of the GitHub App used to open the pull request
7+
required: true
8+
token:
9+
description: GitHub App token with contents and pull request write access
10+
required: true
11+
package-path:
12+
description: Path to the package to release
13+
required: true
14+
pr-body:
15+
description: Pull request body
16+
required: true
17+
tag:
18+
description: Release tag
19+
required: true
20+
version:
21+
description: Release version
22+
required: true
23+
24+
runs:
25+
using: composite
26+
steps:
27+
- name: Open release PR
28+
shell: bash
29+
env:
30+
APP_SLUG: ${{ inputs.app-slug }}
31+
GH_TOKEN: ${{ inputs.token }}
32+
PACKAGE_NAME: ${{ inputs.package-name }}
33+
PACKAGE_PATH: ${{ inputs.package-path }}
34+
PR_BODY: ${{ inputs.pr-body }}
35+
TAG: ${{ inputs.tag }}
36+
VERSION: ${{ inputs.version }}
37+
run: |
38+
BRANCH="release-$PACKAGE_NAME-$VERSION-$GITHUB_RUN_ID"
39+
BOT_ID="$(gh api "/users/$APP_SLUG%5Bbot%5D" --jq .id)"
40+
git config user.name "$APP_SLUG[bot]"
41+
git config user.email "$BOT_ID+$APP_SLUG[bot]@users.noreply.github.com"
42+
git switch -c "$BRANCH"
43+
git add "$PACKAGE_PATH"
44+
git commit -m "release: $TAG"
45+
git push -u "https://x-access-token:$GH_TOKEN@github.com/$GITHUB_REPOSITORY.git" HEAD
46+
gh pr create \
47+
--assignee "$GITHUB_ACTOR" \
48+
--base main \
49+
--head "$BRANCH" \
50+
--title "release: $TAG" \
51+
--body "$PR_BODY"

0 commit comments

Comments
 (0)