The major difference between the response to a cabin leak in the shuttle and station is that, if the leak cannot be stopped, the shuttle would terminate its mission and enter, and the station (or parts of it) would be abandoned. Some information about leak isolation procedures on the station can be found in the answers to Can they isolate individual modules on the ISS?
I will briefly summarize the procedures for shuttle. Some shuttle systems knowledge background is required to fully grasp the rationale. For now, accept that the limiting consumable on shuttle for leaks was always N2, and that the cabin atmosphere must be maintained at or above 8 psi for the purpose of keeping acceptable temperatures on air-cooled equipment in the cabin. For background on the Orbiter cabin pressurization system, refer to Space shuttle cabin atmosphere system
To follow along with this answer, please refer to the procedure which can be found in the Orbit Pocket Checklist, page 4-3. The title is O2 (N2) FLOW HIGH / CAB P LOW / dP/dT. The three parts of the title refer to alarms that can tell the crew to execute the procedures. O2 (N2) FLOW HIGH is an alarm that is set off by high flow rates in the system used to maintain the cabin pressure. CAB P LOW is an alarm set off by low cabin pressure. dP/dT is an alarm set off by a rapid decrease in cabin pressure. Any of these could be caused by a cabin leak.
I will walk through the procedure for the case of an unisolatable leak in an Orbiter which is not docked. If the Orbiter was docked, steps 1 and 2 would execute procedures to determine if the leak was in the station or the Orbiter.
Step 3 shuts off the system used to maintain the cabin pressure. If the rate of change of cabin pressure is at or above zero after this, the high flow alarm was not caused by a leak. Go fix the problem in that system (step 4).
Steps 5 - 19 attempt to find and stop the leak. Various valves in the cabin, the toilet, the hatch, etc. are checked.
After all leak sources have been checked, if the rate of change of cabin pressure is at or above zero, the leak has been stopped. Reconfigure the systems. If it is not, the leak is unisolatable. "PREPARE FOR DEORBIT"
Steps 23-30 reopens valves to the Spacehab and/or airlock to utilize the atmosphere present in those volumes (they have already been excluded as causes of the leak).
The next step is to determine how long the Orbiter can survive at the current leak rate. The definition of Orbiter survival is the cabin pressure remaining at or above 8 psi. This time is based on two sub-times: 1) The time it takes the cabin to leak down to 8 psi, at which time the emergency cabin repressurization system kicks in 2) The time it takes the emergency cabin repressurization system to expend all the stored N2 while maintaining 8 psi in the cabin. These times are calculated by nomographs in the procedure or by an application on a laptop PC. The input to this process is the "Equivalent dp/dT" defined as the rate of decay of the cabin pressure if the cabin pressure was at 14.7 psi. The larger the dp/dt EQ, the larger the leak. The current cabin pressure and the amount of stored N2 determine the amount of gas available to feed the leak.
The Orbiter must be in the atmosphere before the survival time runs out. Hopefully at least an emergency runway can be reached if not one of the prime landing sites. If not the crew must bail out. That is the next decision the crew and mission control must make, when to do the deorbit burn and what to target for a landing.
Once determined, if TIG (time to ignition of the deorbit burn) is less than 2 hours and 40 minutes, a normal Deorbit Prep procedure cannot be executed. The Emergency Deorbit Prep procedure will be executed instead. If TIG is greater than that, a normal Deorbit Prep with loss of cabin pressure deltas will be executed.
The remainder of the procedure concerns itself with maintaining a livable cabin atmosphere as long as possible. Steps 34-38 are for a large leak. The crew must don the Launch and Entry suits and configure the Orbiter systems for this.
Steps 40-44 configure the Orbiter systems to flow as much O2 as possible into the cabin. The crew must manually manage the partial pressure of O2 to remain below flammibility limits using steps 45-50.
Once the cabin pressure reaches 8 psi, the emergency repressurization system kicks in. The crew executes steps 51-57 to configure the systems and then exits the procedure, to join the rest of the crew preparing for deorbit.