Possible to bulk publish content drafts

I’m probably a bit late to the party, but I just used this method to bulk update in Strapi v4. There’s a bootstrap function in index.js. I created a new field (“htmlId”) in my faq content-type (for search functionality) so that I can add an anchor tag to each of my faq articles. I used the entityService available in the api controllers to generate an “htmlId” programmatically:

async bootstrap({ strapi }) {
      const items = await strapi.entityService.findMany("api::faq.faq");
      console.log("items: ", items);
      try {
        items.forEach((item) => {
          strapi.entityService.update("api::faq.faq", item.id, {
            data: {
              htmlId: `Faq_${item.id}`,
            },
          });
        });
      } catch (err) {
        console.log("some error");
   }
}

I’m just a rookie so I’m pretty chuffed I got it to work :grin:
I’m positive the same approach would work for publishing drafts.