flowwer-dev / pull-request-stats

Github action to print relevant stats about Pull Request reviewers
MIT License
366 stars 79 forks source link

Getting 400 error on Slack Integrations #32

Closed anshsrtv closed 2 years ago

anshsrtv commented 2 years ago

I am receiving this error while trying to run the actions in one of my org's private repo.

Error: Request failed with status code 400

Our team Fyle has sponsored the project thinking it might add value but it keeps giving a 400 bad request whenever run. Attaching a screenshot of the logs here.

Screenshot 2022-05-19 at 5 41 31 PM

Let me know if there are any permissions that need to be enabled for sending the message to slack.

manuelmhtr commented 2 years ago

Hi @anshsrtv, First, thank you very much for your support. You are my very first sponsor and that makes your company special to me. I'll work hard to make it worth 💪

Sorry about this problem. I've sent a new version (v2.3.1) adding logs to debug the Slack integration. In order to fix it, could you help me with:

  1. Making sure you are running the action from master, v2 or v2.3.1 (this will make logs available).
  2. Adding the variable ACTIONS_STEP_DEBUG with value true to your repository secrets (in the repo you are running the action). This will enable debug logs.
  3. Sending those logs to me (email: m@nuel.mx). I'm particularly interested in the log that starts with Post a Slack message with params: and the one with Error posting Slack message:.

That would help me a lot to fix this for you. Thank you!

anshsrtv commented 2 years ago

Hey, I tried to debug this and found that the data for 30 days was too big for a single message in slack, so I reduced it to 15 days. Can we get the table format in slack as in the github PR description?

manuelmhtr commented 2 years ago

Thanks for the update @anshsrtv, I'll add this to the "troubleshooting" section.


I reduced it to 15 days

As an alternative, if you need the stats for the lasts 30 or more days, you could use the limit option. This way the stats still calculated for the desired time frame but the message is limited to the first X rows to fit the Slack limitation.


Can we get the table format in slack as in the github PR description?

Unfortunately Slack blocks does not support tables yet. That's a huge limitation to make it looks the same than Github. The only option would post them as an image, but it would loose more important capabilities like copying text, and using links.

However, Slack still improving their Blocks API, I hope anytime soon they support tables and I could migrate to that format then.

anshsrtv commented 2 years ago

Hi @manuelmhtr, Few questions we had:

manuelmhtr commented 2 years ago

@anshsrtv sorry for the late reply.

  1. Review time is calculated as the moment of the first review minus the most recent date between the last commit and the time the PR was published. You can check it here. The logic behind this is, somebody might publish the PR first but keep adding commits before requesting for reviews.

  2. Sounds like a good idea. I'll make some time to launch this feature this week ;)

manuelmhtr commented 2 years ago

Hi @anshsrtv I just released v2.4.1 which now prints the repos or organizations related to the stats.