Skip to content

Commit ca4ed0f

Browse files
authored
Merge pull request #52 from IBM/default_group_detection
Detect the default group
2 parents 4fe2fb5 + 9f470b4 commit ca4ed0f

File tree

6 files changed

+307
-61
lines changed

6 files changed

+307
-61
lines changed

.github/workflows/test.yml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,21 @@ jobs:
162162
ibmcloud target | grep -q '^Region:\s\+us-south$' &&
163163
ibmcloud target | grep -q '^Resource group:\s\+default$'
164164
165+
test-login-with-region:
166+
runs-on: ubuntu-latest
167+
steps:
168+
- uses: actions/checkout@v5
169+
- name: Set up ibmcloud CLI
170+
uses: ./
171+
with:
172+
api_key: ${{ secrets.IBMCLOUD_API_KEY }}
173+
region: us-east
174+
- name: Check logged in
175+
run: |
176+
ibmcloud target | grep -q '^User:\s\+${{ secrets.IBMCLOUD_USER }}$' &&
177+
ibmcloud target | grep -q '^Region:\s\+us-east$' &&
178+
ibmcloud target | grep -q '^Resource group:\s\+default$'
179+
165180
test-login-with-region-and-group:
166181
runs-on: ubuntu-latest
167182
steps:
@@ -178,6 +193,38 @@ jobs:
178193
ibmcloud target | grep -q '^Region:\s\+us-east$' &&
179194
ibmcloud target | grep -q '^Resource group:\s\+manageiq$'
180195
196+
test-login-with-region-and-blank-group:
197+
runs-on: ubuntu-latest
198+
steps:
199+
- uses: actions/checkout@v5
200+
- name: Set up ibmcloud CLI
201+
uses: ./
202+
with:
203+
api_key: ${{ secrets.IBMCLOUD_API_KEY }}
204+
region: us-east
205+
group: ''
206+
- name: Check logged in
207+
run: |
208+
ibmcloud target | grep -q '^User:\s\+${{ secrets.IBMCLOUD_USER }}$' &&
209+
ibmcloud target | grep -q '^Region:\s\+us-east$' &&
210+
ibmcloud target | grep -q '^Resource group:\s\+default$'
211+
212+
test-login-with-region-and-false-group:
213+
runs-on: ubuntu-latest
214+
steps:
215+
- uses: actions/checkout@v5
216+
- name: Set up ibmcloud CLI
217+
uses: ./
218+
with:
219+
api_key: ${{ secrets.IBMCLOUD_API_KEY }}
220+
region: us-east
221+
group: false
222+
- name: Check logged in
223+
run: |
224+
ibmcloud target | grep -q '^User:\s\+${{ secrets.IBMCLOUD_USER }}$' &&
225+
ibmcloud target | grep -q '^Region:\s\+us-east$' &&
226+
ibmcloud target | grep -q '^Resource group:\s\+No resource group targeted'
227+
181228
test-login-failure:
182229
runs-on: ubuntu-latest
183230
steps:
@@ -225,7 +272,7 @@ jobs:
225272
- name: Check basic CLI function
226273
run: ibmcloud --version
227274

228-
test-all-platforms:
275+
test-os:
229276
strategy:
230277
matrix:
231278
os:

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ steps:
3030

3131
- `region`: (optional - default: `us-south`) Region to access on IBM Cloud.
3232

33-
- `group`: (optional - default: `default`) Resource group to access on IBM Cloud.
33+
- `group`: (optional) Resource group to access on IBM Cloud.
34+
35+
If not provided, the default resource group will be detected and targeted. To skip the detection of the default resource group, set this to `false`.
3436

3537
- `api`: (optional - default: `https://cloud.ibm.com`) API endpoint to IBM Cloud.
3638

action.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@ branding:
66
color: blue
77
inputs:
88
api_key:
9-
description: API Key to login to IBM Cloud obtained from your [IAM settings](https://cloud.ibm.com/iam/apikeys).
9+
description: |
10+
API Key to login to IBM Cloud obtained from your [IAM settings](https://cloud.ibm.com/iam/apikeys).
11+
12+
If not provided, no attempt will be made to login in and you will need to login with the IBM Cloud CLI directly in a subsequent step.
1013
region:
1114
description: Region to access on IBM Cloud.
1215
default: us-south
1316
group:
14-
description: Resource group to access on IBM Cloud.
15-
default: default
17+
description: |
18+
Resource group to access on IBM Cloud.
19+
20+
If not provided, the default resource group will be detected and targeted. To skip the detection of the default resource group, set this to `false`.
1621
api:
1722
description: API endpoint to IBM Cloud.
1823
default: https://cloud.ibm.com

dist/index.js

Lines changed: 122 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)