Skip to content

Commit 854ff9c

Browse files
committed
Updated action
1 parent 52c8425 commit 854ff9c

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

README.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ GitHub action to submit PRs to OpenShift operator repositories.
1010

1111
### Before using this action
1212

13-
You must fork the [operator repositories](#operator-repositories) you are willing to submit your operator to.
13+
- Fork the [operator repositories](#operator-repositories) you are willing to submit your operator to.
14+
- Get a GitHub PAT with write access to the previous repo.
1415

1516
### Usage
1617

@@ -26,9 +27,11 @@ jobs:
2627
operator-pr:
2728
name: Version
2829
runs-on: ubuntu-latest
30+
permissions:
31+
contents: write
2932
steps:
3033
- name: Checkout
31-
uses: actions/checkout@v3
34+
uses: actions/checkout@v4
3235
with:
3336
fetch-depth: 0
3437

@@ -50,13 +53,13 @@ jobs:
5053

5154
- name: Operator PR
5255
uses: mariadb-operator/[email protected]
56+
env:
57+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
5358
with:
5459
name: "mariadb-operator"
5560
version: "${{ steps.version.outputs.version }}"
5661
fork-repo-name: "mariadb-operator/community-operators"
57-
upstream-repo-url: "https://github.com/k8s-operatorhub/community-operators"
62+
upstream-repo-name: "k8s-operatorhub/community-operators"
5863
bundle-path-dir: "bundle"
5964
ci-path-file: "ci.yaml"
60-
user-name: "Martin Montes"
61-
user-email: "[email protected]"
6265
```

action.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ inputs:
1313
fork-repo-name:
1414
description: "OpenShift operators fork repository name e.g.\"mariadb-operator/community-operators\"."
1515
required: true
16-
upstream-repo-url:
17-
description: "OpenShift operators upstream repository https URL e.g.\"https://github.com/k8s-operatorhub/community-operators\"."
16+
upstream-repo-name:
17+
description: "OpenShift operators upstream repository name e.g.\"k8s-operatorhub/community-operators\"."
1818
required: true
1919
bundle-path-dir:
2020
description: "Path to the OLM bundle directory."
2121
required: true
2222
ci-path-file:
23-
description: "Path to the ci.yaml file"
23+
description: "Path to the ci.yaml file."
2424
required: true
2525
user-name:
2626
description: "User name to use in the commit."
@@ -41,7 +41,7 @@ runs:
4141
exit 1
4242
4343
- name: Check GITHUB_TOKEN env
44-
if: ${{ env.GITHUB_TOKEN == '' }}
44+
if: ${{ !env.GITHUB_TOKEN }}
4545
shell: bash
4646
run: |
4747
echo "::error title=⛔ error hint::GITHUB_TOKEN environment variable is mandatory"
@@ -53,7 +53,7 @@ runs:
5353
fetch-depth: 0
5454
repository: "${{ inputs.fork-repo-name }}"
5555
path: "."
56-
token: "${{ secrets.GITHUB_TOKEN }}"
56+
token: "${{ env.GITHUB_TOKEN }}"
5757

5858
- name: Configure Git
5959
shell: bash
@@ -64,16 +64,16 @@ runs:
6464
- name: Upstream PR
6565
shell: bash
6666
env:
67-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
67+
GITHUB_TOKEN: "${{ env.GITHUB_TOKEN }}"
6868
run: |
6969
echo "🚀 Setting up upstream"
70-
git remote add upstream "${{ inputs.upstream-repo-url }}"
70+
git remote add upstream "https://github.com/${{ inputs.upstream-repo-name }}"
7171
git fetch --all
7272
git reset --hard upstream/main
7373
7474
echo "🚀 Copying bundle"
7575
mkdir -p "operators/${{ inputs.name }}/${{ inputs.version }}"
76-
cp -Tr "${{ inputs.bundle-path-dir }}" "operators/${{ inputs.name }}/${{ inputs.version }}"
76+
cp -r "${{ inputs.bundle-path-dir }}"/* "operators/${{ inputs.name }}/${{ inputs.version }}"
7777
7878
echo "🚀 Copying ci.yaml"
7979
cp "${{ inputs.ci-path-file }}" "operators/${{ inputs.name }}/"
@@ -82,6 +82,6 @@ runs:
8282
git add .
8383
git commit -m "operator ${{ inputs.name }}(${{ inputs.version }})" --signoff
8484
git push -f
85-
gh pr create --repo $UPSTREAM_REPO \
85+
gh pr create --repo "${{ inputs.upstream-repo-name }}" \
8686
--title "operator ${{ inputs.name }} (${{ inputs.version }})" \
8787
--body "Added operator ${{ inputs.name }} (${{ inputs.version }})"

0 commit comments

Comments
 (0)