-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: chunk plugins using repository_dispatch
- Loading branch information
Showing
3 changed files
with
32 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
schedule: | ||
# Runs every 4 hours | ||
- cron: "0 */4 * * *" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
chunk-publish-workflows: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Trigger workflows for each chunk | ||
run: | | ||
jq '{plugins: .plugins | _nwise(256)}' plugins.json | jq -s '{chunks: .}' > chunks.json | ||
# The above command outputs a nested list | ||
CHUNK_COUNT=$(jq '.chunks | length' chunks.json) | ||
for ((i = 0 ; i < CHUNK_COUNT ; i++ )); do | ||
PAYLOAD=$(jq -c '.chunks[$i]' chunks.json) | ||
curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github+json" \ | ||
"https://api.github.com/repos/nvim-neorocks/nurr/dispatches" \ | ||
-d '{"event_type":"chunked_trigger","client_payload":$PAYLOAD}' | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
chunks.json |