-
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (58 loc) · 2.03 KB
/
create-bump-pr.yaml
File metadata and controls
68 lines (58 loc) · 2.03 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Create bump package versions PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
create-bump-pr:
name: Create bump package versions PR
environment: CI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
id: create_token
with:
client-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: Version packages
run: pnpm changeset version
- name: Commit release
id: commit
run: |
if git diff --quiet; then
echo "No changes"
echo "has_changes=false" >> $GITHUB_OUTPUT
exit 0
fi
echo "has_changes=true" >> $GITHUB_OUTPUT
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B changeset-release/master
git add .
git commit -m "chore: bump package versions"
- name: Push branch
if: steps.commit.outputs.has_changes == 'true'
run: git push origin changeset-release/master --force
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Open PR
if: steps.commit.outputs.has_changes == 'true'
run: |
if [ "$(gh pr list --head changeset-release/master --state open --json number --jq 'length')" -eq 0 ]; then
gh pr create \
--base master \
--head changeset-release/master \
--title "[Changesets] Bump package versions" \
--body "Automated release PR"
fi
env:
GH_TOKEN: ${{ steps.create_token.outputs.token }}