forked from tektoncd/cli
-
Notifications
You must be signed in to change notification settings - Fork 2
45 lines (43 loc) · 2.13 KB
/
auto-merge-upstream.yaml
File metadata and controls
45 lines (43 loc) · 2.13 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
# Generated for Konflux Application openshift-pipelines-cli by openshift-pipelines/hack. DO NOT EDIT
name: auto-merge-upstream
on:
workflow_dispatch: {}
schedule:
- cron: "0,30 * * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
collect-branches:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Get branches matching pattern
id: set-matrix
run: |
# List all branches and filter
branches=$(gh api repos/${{ github.repository }}/branches --paginate -q '.[] | .name' | grep -E '^(release-v.*\.x$|next$)')
echo "Found branches:"
echo "$branches"
# Convert to JSON array for matrix
json=$(jq -nc --argjson arr "$(printf '%s\n' "$branches" | jq -R . | jq -s .)" '{branch: $arr}')
echo "Matrix JSON: $json"
echo "matrix=$json" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
auto-merge-upstream-all:
needs: collect-branches
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.collect-branches.outputs.matrix) }}
steps:
- name: Trigger auto-merge-upstream for ${{ matrix.branch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo Triggering workflow for branch: ${{ matrix.branch }}
gh workflow run "auto-merge-upstream.yaml" \
--ref ${{ matrix.branch }} \
--repo ${{ github.repository }}