Merge pull request #29551 from woocommerce/fix/allow-local-slackbot
Allow local slackbot
This commit is contained in:
commit
be44da32de
|
@ -1,5 +1,6 @@
|
||||||
const { createReadStream } = require( 'fs' );
|
const { createReadStream } = require( 'fs' );
|
||||||
const { WebClient, ErrorCode } = require( '@slack/web-api' );
|
const { WebClient, ErrorCode } = require( '@slack/web-api' );
|
||||||
|
const { getTestConfig } = require( '../../utils' );
|
||||||
const {
|
const {
|
||||||
GITHUB_ACTIONS,
|
GITHUB_ACTIONS,
|
||||||
GITHUB_REF,
|
GITHUB_REF,
|
||||||
|
@ -37,7 +38,12 @@ const initializeSlack = () => {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ( ! GITHUB_ACTIONS && ! TRAVIS_PULL_REQUEST_BRANCH ) {
|
if ( ! GITHUB_ACTIONS && ! TRAVIS_PULL_REQUEST_BRANCH ) {
|
||||||
return false;
|
const testConfig = getTestConfig();
|
||||||
|
return {
|
||||||
|
branch: 'local environment',
|
||||||
|
commit: 'latest',
|
||||||
|
webUrl: testConfig.url,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
// Build PR info
|
// Build PR info
|
||||||
if ( GITHUB_ACTIONS ) {
|
if ( GITHUB_ACTIONS ) {
|
||||||
|
@ -80,7 +86,9 @@ export async function sendFailedTestMessageToSlack( testName ) {
|
||||||
// Check the code property and log the response
|
// Check the code property and log the response
|
||||||
if ( error.code === ErrorCode.PlatformError || error.code === ErrorCode.RequestError ||
|
if ( error.code === ErrorCode.PlatformError || error.code === ErrorCode.RequestError ||
|
||||||
error.code === ErrorCode.RateLimitedError || error.code === ErrorCode.HTTPError ) {
|
error.code === ErrorCode.RateLimitedError || error.code === ErrorCode.HTTPError ) {
|
||||||
console.log( error.data );
|
if ( error.data.error != 'channel_not_found' ) {
|
||||||
|
console.log(error.data);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Some other error, oh no!
|
// Some other error, oh no!
|
||||||
console.log(
|
console.log(
|
||||||
|
|
Loading…
Reference in New Issue