-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (47 loc) · 1.37 KB
/
synchronise-trunk-version-npm.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
47
48
49
50
name: Synchronise all PR versions
on:
workflow_call:
inputs:
trunk-branch:
required: true
type: string
default: main
secrets:
bot-id:
required: true
bot-key:
required: true
permissions:
contents: write
pull-requests: write
jobs:
find-pull-requests:
runs-on: ubuntu-latest
outputs:
pr_list: ${{ steps.find.outputs.pr_list }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TRUNK_BRANCH: ${{ inputs.trunk-branch }}
steps:
- name: Checkout ${{ inputs.trunk-branch }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.trunk-branch }}
- name: find pull requests
id: find
run: |
PR_LIST=$(gh pr list --base $TRUNK_BRANCH --search "label:v:major,v:minor,v:patch" --json number --jq "map(.number)")
echo "pr_list=$PR_LIST" >> $GITHUB_OUTPUT
synchronise-pull-requests:
needs: find-pull-requests
if: ${{ join(fromJSON(needs.find-pull-requests.outputs.pr_list), '') != '' }}
strategy:
matrix:
pr_number: ${{ fromJSON(needs.find-pull-requests.outputs.pr_list) }}
uses: ./.github/workflows/synchronise-pr-version-npm.yml
with:
pr-number: ${{ matrix.pr_number }}
trunk-branch: ${{ inputs.trunk-branch }}
secrets:
bot-id: ${{ secrets.bot-id }}
bot-key: ${{ secrets.bot-key }}