javadiscord / java-discord-api

A wrapper over the discord API to create bots using Java
GNU General Public License v3.0
7 stars 8 forks source link

Use multiple API keys for pre-merge testing #126

Closed surajkumar closed 4 months ago

surajkumar commented 4 months ago

When running the pre-commit Github Action we are sometimes rate limited when there are too many concurrent actions running.

Instead what we can implement to mitigate this round robin the secrets.

Here's an example of what we can do:

Add a select key step:

- name: Select API key
  id: select_api_key
  run: echo "::set-output name=api_key::${{ secrets.API_KEY_$(( github.run_number % NUM_KEYS + 1 )) }}"

To use the key: API_KEY: ${{ steps.select_api_key.outputs.api_key }}

We would need to create multiple discord API keys for this work and create them as API_KEY_1, API_KEY_2, API_KEY_3

surajkumar commented 4 months ago

No longer needed - this has been fixed with parsing the rate limit headers