Hi Carolyn,
A couple of things:
First, it's helpful to know that in the database schema, a repository is actually a subtype of actor - so there is a link to the tables used for authorities, which is likely causing the behavior you're seeing.
This question has come up before - fortunately for you! Which means I have previously tracked down an AtoM developer and had them help me craft something for this particular use case. Turns out it's more complicated than you'd expect! If you check the docs, you will see a query example for updating the publication status of all records in a system, or at the end of the following section, there's a longer SQL query example showing how to update just those associated with a particular repository:
So: if you're trying to update all records, then there's no need for a script to find the IDs and pass them through the pub status task - you can just use SQL to do it for all records at once - in fact, the docs for the publication status task link to this SQL query and recommend using it if you're trying to update thousands of records at once! And if you only want to update one or a couple repositories, then use the longer SQL query example provided.
Of course, as always when using scripts and SQL to modify your records, we strongly recommend you make a backup first!
Hope that helps,