diff --git a/.github/workflows/customJson.yml b/.github/workflows/customJson.yml index 91a5f3c..d15902c 100644 --- a/.github/workflows/customJson.yml +++ b/.github/workflows/customJson.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Publish to slack id: slack - uses: slackapi/slack-github-action@v1.5.0 + uses: slackapi/slack-github-action@v1.6.0 with: payload: '{key: "value", foo: "bar"}' env: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8d8e29b..9ec573b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Publish to slack id: slack - uses: slackapi/slack-github-action@v1.5.0 + uses: slackapi/slack-github-action@v1.6.0 with: channel-id: 'CTAAHRA79' slack-message: 'posting from a github action!' diff --git a/dist/index.js b/dist/index.js index 47ad8e3..fa523b0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -16057,9 +16057,11 @@ try { let payload = core.getInput('payload'); + console.log('payload:') console.log(payload) + console.log(typeof payload) - if (payload === undefined) { + if (payload.length > 0) { console.log('undefined payload'); console.log('no payload passed in, using payload that triggered the GitHub Action') // Get the JSON webhook payload for the event that triggered the workflow @@ -16081,11 +16083,11 @@ try { throw 'Need to provide at least one botToken or webhookUrl' } - const channelId = core.getInput('channel-id'); - console.log('channelId', channelId, typeof channelId) - if (botToken.length > 0 && channelId !== undefined) { + if (botToken.length > 0) { const message = core.getInput('slack-message'); + const channelId = core.getInput('channel-id'); console.log('message', message, typeof message) + console.log('channelId', channelId, typeof channelId) const web = new WebClient(botToken); diff --git a/index.js b/index.js index 5c8befb..9a0e485 100644 --- a/index.js +++ b/index.js @@ -13,10 +13,11 @@ try { let payload = core.getInput('payload'); - console.log('payload') + console.log('payload:') console.log(payload) + console.log(typeof payload) - if (payload === undefined) { + if (payload.length > 0) { console.log('undefined payload'); console.log('no payload passed in, using payload that triggered the GitHub Action') // Get the JSON webhook payload for the event that triggered the workflow diff --git a/package.json b/package.json index a977cd9..ffe1a7a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "slack-github-action", - "version": "1.5.0", + "version": "1.6.0", "description": "The official slack github action. Use this to send data into your Slack workspace", "main": "dist/index.js", "scripts": {