I use a simple push button to trigger an action on my Arduino Uno. Since I want to listen to the interrupt event, I'm using pin 2 with ground. The pin mode is set to input with pinMode(2, INPUT); That all works well with the code and the callback function is called when I press the button.
My question is now if there is any risk in creating a short-circuit between the pin and ground when pressing the button? Should I use a resistor to reduce the current? Or is all safe, as long as I use the "input" mode?
Start by using a pinMode() of INPUT_PULLUP to turn on the built in pullup resistor on the pin. It is common practice to do this and have the pin taken to GND by a switch or button
There is no danger in doing this as long as you wire it correctly
However, I would question whether you need to use an interrupt at all to detect a button press
It's safe and since input pins have resistance around 100 megohms, essentially no current flows.
But with a switch/button you need a pull-up resistor (you can enable the internal pull-up) so the input doesn't float to an unknown voltage/state when the button is not pushed. Then when you turn-on the switch, grounding it, current does flow.