Skip to content

Commit 02e9967

Browse files
authored
Merge pull request #24 from gruntwork-io/ore/dev-1368-update-error-text-when-pipelines-are-paused
Update error text when pipelines are paused due to usage limit
2 parents 37715f9 + 0f64519 commit 02e9967

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

action.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ runs:
7272
7373
const handleLimitExceeded = async (body) => {
7474
const limit = body?.detail?.limits?.[0]?.limit
75-
const limitText = limit ? ` of **${limit}** infrastructure units` : ''
76-
const message = `You've exceeded your plan's usage limit${limitText}. To continue using Pipelines, contact sales to upgrade your plan or request a one-time restoration of service during which you may reduce your usage.`
75+
const used = body?.detail?.limits?.[0]?.used
76+
const excess = used - limit
77+
const devPortalUrl = 'https://app.gruntwork.io'
78+
const salesEmail = 'sales@gruntwork.io'
79+
const message = `You're now using **${used} of ${limit}** infrastructure units included in your plan—exceeding the limit by **${excess} units**. Effective immediately, **your pipelines have been paused** for all of your repositories.\n\nTo continue using Pipelines, [contact sales](mailto:${salesEmail}) to upgrade your plan or request a one-time restoration of service during which you may reduce your usage. You can view your current usage in the [Gruntwork Developer Portal](${devPortalUrl}).`
7780
7881
await core.summary
7982
.addHeading('Your Pipelines have been paused')

test/action.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ describe('pipelines-credentials action', () => {
164164

165165
expect(core.summary.addHeading).toHaveBeenCalledWith('Your Pipelines have been paused');
166166
expect(core.summary.addRaw).toHaveBeenCalledWith(
167-
expect.stringContaining('**100** infrastructure units')
167+
expect.stringContaining('**120 of 100** infrastructure units included in your plan—exceeding the limit by **20 units**')
168168
);
169169
expect(core.summary.write).toHaveBeenCalled();
170170
expect(core.setOutput).toHaveBeenCalledWith('PIPELINES_TOKEN', 'fallback-pat');

0 commit comments

Comments
 (0)