Skip to content

Commit

Permalink
made it so that update-llama-cpp.yml gets rid of the old prs and also…
Browse files Browse the repository at this point in the history
… manually runs the CI on itself
  • Loading branch information
actions-user committed Mar 10, 2024
1 parent f9dc801 commit 0a7c301
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/llama-cpp-rs-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches:
- main
workflow_dispatch:
repository_dispatch:
types: [ trigger-llama-cpp-rs-check ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
28 changes: 22 additions & 6 deletions .github/workflows/update-llama-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Update llama cpp nightly
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch: {}
workflow_dispatch: { }

permissions:
pull-requests: write
Expand All @@ -17,8 +17,11 @@ jobs:
name: Checkout latest
with:
submodules: recursive
- name: create branch
run: git checkout -b update-llama-cpp-$(date -I)
- name: create branch and save branch name
run: |
BRANCH_NAME=update-llama-cpp-$(date -I)
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
git checkout -b $BRANCH_NAME
- name: update submodules
run: git submodule update --remote
- name: config git
Expand All @@ -28,8 +31,21 @@ jobs:
- name: commit
run: git commit -am "updated llama.cpp"
- name: push
run: git push --set-upstream origin update-llama-cpp-$(date -I) --force
- name: create draft pr
run: git push --set-upstream origin $BRANCH_NAME --force
- name: close any outdated prs with the same name
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr list --state open --json number,title | jq -r '.[] | select(.title | contains("'"$BRANCH_NAME"'")) | .number' | xargs -I {} gh pr close {}
- name: create open pr
run: |
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
gh pr create --fill --draft --body "please close and reopen this pull request to trigger the checks"
gh pr create --fill --open
- name: Trigger the llama-cpp-rs-check workflow
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.everest-preview+json" \
"https://api.github.com/repos/${{ github.repository }}/dispatches" \
-d '{"event_type": "trigger-llama-cpp-rs-check", "client_payload": {"branch": "'"$BRANCH_NAME"'" }}'

0 comments on commit 0a7c301

Please sign in to comment.