Skip to content

Commit 7c11f61

Browse files
chore: add manual dispatch option (#1709)
1 parent 2b43b3a commit 7c11f61

1 file changed

Lines changed: 160 additions & 0 deletions

File tree

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
name: Create Change Tracking Event
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
accountId:
10+
description: 'New Relic Account ID (e.g., 1067061, 550352)'
11+
required: true
12+
type: choice
13+
options:
14+
- '1067061'
15+
- '550352'
16+
region:
17+
description: 'New Relic Region'
18+
required: true
19+
type: choice
20+
options:
21+
- 'US'
22+
- 'EU'
23+
- 'Staging'
24+
version:
25+
description: 'Version being deployed (required for Deployment category)'
26+
required: true
27+
type: string
28+
category:
29+
description: 'Event Category'
30+
required: true
31+
type: choice
32+
default: 'Deployment'
33+
options:
34+
- 'Deployment'
35+
- 'Feature Flag'
36+
type:
37+
description: 'Deployment Type'
38+
required: true
39+
type: choice
40+
default: 'Basic'
41+
options:
42+
- 'Basic'
43+
- 'Rolling'
44+
- 'Other'
45+
- 'Blue Green'
46+
- 'Canary'
47+
- 'Shadow'
48+
featureFlagId:
49+
description: 'Feature Flag ID (required when category is Feature Flag)'
50+
required: false
51+
type: string
52+
description:
53+
description: 'Description of the event'
54+
required: true
55+
type: string
56+
shortDescription:
57+
description: 'Short description for the event'
58+
required: true
59+
type: string
60+
changelog:
61+
description: 'Changelog for the deployment (URL or text)'
62+
required: false
63+
type: string
64+
deepLink:
65+
description: 'Deep link URL for the deployment'
66+
required: false
67+
type: string
68+
groupId:
69+
description: 'String to correlate two or more events'
70+
required: false
71+
type: string
72+
73+
jobs:
74+
create-change-tracking-event:
75+
runs-on: Browser-Agent-Assigned-IP-Linux
76+
timeout-minutes: 5
77+
defaults:
78+
run:
79+
shell: bash
80+
steps:
81+
- uses: actions/checkout@v4
82+
83+
- name: Determine Entity GUID and API Key
84+
id: entity-config
85+
run: |
86+
ACCOUNT_ID="${{ inputs.accountId }}"
87+
REGION="${{ inputs.region }}"
88+
89+
# Determine API key based on account ID
90+
if [ "$ACCOUNT_ID" = "1067061" ]; then
91+
echo "apiKey=${{ secrets.NR_CHANGE_TRACKING_API_KEY_NR1 }}" >> $GITHUB_OUTPUT
92+
elif [ "$ACCOUNT_ID" = "550352" ]; then
93+
echo "apiKey=${{ secrets.NR_CHANGE_TRACKING_API_KEY_BROWSER }}" >> $GITHUB_OUTPUT
94+
else
95+
echo "Error: Unknown account ID: $ACCOUNT_ID"
96+
exit 1
97+
fi
98+
99+
# Determine entity GUID based on account ID and region
100+
if [ "$ACCOUNT_ID" = "1067061" ]; then
101+
case "$REGION" in
102+
"US")
103+
echo "entityGuid=${{ secrets.NR_ENTITY_GUID_NR1_US_PROD }}" >> $GITHUB_OUTPUT
104+
;;
105+
"EU")
106+
echo "entityGuid=${{ secrets.NR_ENTITY_GUID_NR1_EU_PROD }}" >> $GITHUB_OUTPUT
107+
;;
108+
"Staging")
109+
echo "entityGuid=${{ secrets.NR_ENTITY_GUID_NR1_STAGING }}" >> $GITHUB_OUTPUT
110+
;;
111+
*)
112+
echo "Error: Invalid region $REGION for account $ACCOUNT_ID"
113+
exit 1
114+
;;
115+
esac
116+
elif [ "$ACCOUNT_ID" = "550352" ]; then
117+
if [ "$REGION" = "Staging" ]; then
118+
echo "entityGuid=${{ secrets.NR_ENTITY_GUID_BROWSER_STAGING }}" >> $GITHUB_OUTPUT
119+
else
120+
echo "Error: Account 550352 only supports Staging region"
121+
exit 1
122+
fi
123+
fi
124+
125+
- name: Create Change Tracking Event
126+
uses: ./.github/actions/change-tracking
127+
with:
128+
accountId: ${{ inputs.accountId }}
129+
entityGuid: ${{ steps.entity-config.outputs.entityGuid }}
130+
apiKey: ${{ steps.entity-config.outputs.apiKey }}
131+
region: ${{ inputs.region }}
132+
version: ${{ inputs.version }}
133+
category: ${{ inputs.category }}
134+
type: ${{ inputs.type }}
135+
featureFlagId: ${{ inputs.featureFlagId }}
136+
description: ${{ inputs.description }}
137+
shortDescription: ${{ inputs.shortDescription }}
138+
changelog: ${{ inputs.changelog }}
139+
commit: ${{ github.sha }}
140+
deepLink: ${{ inputs.deepLink }}
141+
user: ${{ github.actor }}
142+
groupId: ${{ inputs.groupId }}
143+
144+
- name: Summary
145+
run: |
146+
echo "## Change Tracking Event Created! :rocket:" >> $GITHUB_STEP_SUMMARY
147+
echo "" >> $GITHUB_STEP_SUMMARY
148+
echo "**Category:** ${{ inputs.category }}" >> $GITHUB_STEP_SUMMARY
149+
echo "**Type:** ${{ inputs.type }}" >> $GITHUB_STEP_SUMMARY
150+
echo "**Account ID:** ${{ inputs.accountId }}" >> $GITHUB_STEP_SUMMARY
151+
echo "**Region:** ${{ inputs.region }}" >> $GITHUB_STEP_SUMMARY
152+
echo "**Version:** ${{ inputs.version }}" >> $GITHUB_STEP_SUMMARY
153+
if [ -n "${{ inputs.featureFlagId }}" ]; then
154+
echo "**Feature Flag ID:** ${{ inputs.featureFlagId }}" >> $GITHUB_STEP_SUMMARY
155+
fi
156+
if [ -n "${{ inputs.description }}" ]; then
157+
echo "**Description:** ${{ inputs.description }}" >> $GITHUB_STEP_SUMMARY
158+
fi
159+
echo "**Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
160+
echo "**User:** ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)