Merge pull request #29551 from woocommerce/fix/allow-local-slackbot

Allow local slackbot
This commit is contained in:
Veljko V 2021-04-06 16:35:48 +02:00 committed by GitHub
commit be44da32de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,6 @@
const { createReadStream } = require( 'fs' );
const { WebClient, ErrorCode } = require( '@slack/web-api' );
const { getTestConfig } = require( '../../utils' );
const {
GITHUB_ACTIONS,
GITHUB_REF,
@ -37,7 +38,12 @@ const initializeSlack = () => {
return false;
}
if ( ! GITHUB_ACTIONS && ! TRAVIS_PULL_REQUEST_BRANCH ) {
return false;
const testConfig = getTestConfig();
return {
branch: 'local environment',
commit: 'latest',
webUrl: testConfig.url,
};
}
// Build PR info
if ( GITHUB_ACTIONS ) {
@ -80,7 +86,9 @@ export async function sendFailedTestMessageToSlack( testName ) {
// Check the code property and log the response
if ( error.code === ErrorCode.PlatformError || error.code === ErrorCode.RequestError ||
error.code === ErrorCode.RateLimitedError || error.code === ErrorCode.HTTPError ) {
console.log( error.data );
if ( error.data.error != 'channel_not_found' ) {
console.log(error.data);
}
} else {
// Some other error, oh no!
console.log(