Skip to content

Conversation

@WilliamBergamin
Copy link
Contributor

Summary

Environment variable management of SLACK_BOT_TOKEN and SLACK_APP_TOKEN is now handled by the CLI these changes remove the duplicate implementation from the hooks

Testing

  1. slack create tests-automation -t https://github.com/slack-samples/bolt-python-custom-function-template
  2. Pull this branch
  3. This this project run scripts/build_pypi_package.sh
  4. slack create tests-automation -t https://github.com/slack-samples/bolt-python-custom-function-template
  5. cd tests-automation
  6. In the requirements.txt replace slack-cli-hooks with path/to/python-slack-hooks/dist/slack_cli_hooks-0.0.0.dev2-py3-none-any.whl
  7. python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt
  8. slack run

Everything should work 👍

Special notes

N/A

Requirements

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run ./scripts/install_and_run_tests.sh after making the changes.

Environment variable management is now handled by the CLI it does not need to be handled by the hooks as well
@WilliamBergamin WilliamBergamin added the bug Something isn't working label Feb 22, 2024
@WilliamBergamin WilliamBergamin self-assigned this Feb 22, 2024
@WilliamBergamin WilliamBergamin added enhancement New feature or request and removed bug Something isn't working labels Feb 22, 2024
Copy link
Contributor

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and works great! Always exciting to see lines removed 🪓

Comment on lines -20 to -24
def validate_env() -> None:
if not os.environ.get(SLACK_CLI_XOXB):
raise CliError(f"Missing local run bot token ({SLACK_CLI_XOXB}).")
if not os.environ.get(SLACK_CLI_XAPP):
raise CliError(f"Missing local run app token ({SLACK_CLI_XAPP}).")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No harm in removing this IMO since an error will eventually be caught in the app if these variables are expected! I imagine this guard was to ensure hooks are called from the CLI but I'm honestly not sure 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember correctly this was additional safeguard that was originally put in but we don't need it anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants