Skip to content

Commit 183553a

Browse files
committed
feat: allow passing environment as optional input
1 parent e0a05ff commit 183553a

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,19 @@ jobs:
6767
token: ${{ secrets.SCRIBD_SLACK_GENERIC_TOKEN_PUBLIC }}
6868
channel: test-release-notification
6969
status: failure
70+
test-overwrite-environment:
71+
runs-on: ubuntu-22.04
72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v3
75+
with:
76+
token: ${{ secrets.SCRIBD_GITHUB_RELEASE_TOKEN }}
77+
- name: Run action
78+
uses: ./
79+
with:
80+
token: ${{ secrets.SCRIBD_SLACK_GENERIC_TOKEN_PUBLIC }}
81+
channel: test-release-notification
82+
environment: test-environment
7083

7184
codeowners:
7285
runs-on: ubuntu-22.04

action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ inputs:
1717
description: Customize the notification status to be "success", "failure" or a custom value.
1818
required: false
1919
default: ${{ job.status }}
20+
environment:
21+
description: Customize the environment to be something other than branch name
22+
required: false
23+
default: ${{ github.ref_name }}
2024
message:
2125
description: Customize the notification message.
2226

@@ -79,8 +83,8 @@ runs:
7983
"short": true
8084
},
8185
{
82-
"title": "Environment",
83-
"value": "${{ github.ref_name == 'main' && 'production' || github.ref_name }}",
86+
"title": "Environment/Branch",
87+
"value": "${{ inputs.environment || github.ref_name }}",
8488
"short": true
8589
},
8690
{

0 commit comments

Comments
 (0)