1+ name : " OpenShift operator PR"
2+ description : " Submit PRs to OpenShift operator repositories"
3+ branding :
4+ icon : " git-pull-request"
5+ color : " red"
6+ inputs :
7+ name :
8+ description : " Operator name to submit."
9+ required : true
10+ version :
11+ description : " Operator version to submit."
12+ required : true
13+ fork-repo-name :
14+ description : " OpenShift operators fork repository name e.g.\" mariadb-operator/community-operators\" ."
15+ required : true
16+ upstream-repo-url :
17+ description : " OpenShift operators upstream repository https URL e.g.\" https://github.com/k8s-operatorhub/community-operators\" ."
18+ required : true
19+ bundle-path-dir :
20+ description : " Path to the OLM bundle directory."
21+ required : true
22+ ci-path-file :
23+ description : " Path to the ci.yaml file"
24+ required : true
25+ user-name :
26+ description : " User name to use in the commit."
27+ required : false
28+ default : " $GITHUB_ACTOR"
29+ user-email :
30+ description : " User email to use in the commit."
31+ required : false
32+ default : " $GITHUB_ACTOR@users.noreply.github.com"
33+ runs :
34+ using : ' composite'
35+ steps :
36+ - name : Check Runner OS
37+ if : ${{ runner.os != 'Linux' }}
38+ shell : bash
39+ run : |
40+ echo "::error title=⛔ error hint::Support Linux Only"
41+ exit 1
42+
43+ - name : Check GITHUB_TOKEN env
44+ if : ${{ env.GITHUB_TOKEN == '' }}
45+ shell : bash
46+ run : |
47+ echo "::error title=⛔ error hint::GITHUB_TOKEN environment variable is mandatory"
48+ exit 1
49+
50+ - name : Checkout fork
51+ uses : actions/checkout@v4
52+ with :
53+ fetch-depth : 0
54+ repository : " ${{ inputs.fork-repo-name }}"
55+ path : " ."
56+ token : " ${{ secrets.GITHUB_TOKEN }}"
57+
58+ - name : Configure Git
59+ shell : bash
60+ run : |
61+ git config user.name "${{ inputs.user-name }}"
62+ git config user.email "${{ inputs.user-email }}"
63+
64+ - name : Upstream PR
65+ shell : bash
66+ env :
67+ GITHUB_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
68+ run : |
69+ echo "🚀 Setting up upstream"
70+ git remote add upstream "${{ inputs.upstream-repo-url }}"
71+ git fetch --all
72+ git reset --hard upstream/main
73+
74+ echo "🚀 Copying bundle"
75+ mkdir -p "operators/${{ inputs.name }}/${{ inputs.version }}"
76+ cp -Tr "${{ inputs.bundle-path-dir }}" "operators/${{ inputs.name }}/${{ inputs.version }}"
77+
78+ echo "🚀 Copying ci.yaml"
79+ cp "${{ inputs.ci-path-file }}" "operators/${{ inputs.name }}/"
80+
81+ echo "🚀 Submitting PR"
82+ git add .
83+ git commit -m "operator ${{ inputs.name }}(${{ inputs.version }})" --signoff
84+ git push -f
85+ gh pr create --repo $UPSTREAM_REPO \
86+ --title "operator ${{ inputs.name }} (${{ inputs.version }})" \
87+ --body "Added operator ${{ inputs.name }} (${{ inputs.version }})"
0 commit comments