-
Notifications
You must be signed in to change notification settings - Fork 457
Switch to ldk-fuzzing-corpus repo rather than CI cache #4588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
valentinewallace
merged 1 commit into
lightningdevkit:main
from
TheBlueMatt:2026-05-ci-corpus-repo
May 4, 2026
+148
−30
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,92 @@ | ||
| name: Push fuzz corpus | ||
|
|
||
| # Triggered after the main CI workflow finishes. Because `workflow_run` always | ||
| # runs in the *base* repo's context (its workflow file as of `main`, with | ||
| # full secrets access) it's safe to handle the corpus push here even for fork | ||
| # PRs — none of the PR's modified code or scripts execute in this job. | ||
| # | ||
| # Caveat: GitHub only fires `workflow_run` for workflow files that live on | ||
| # the default branch, so this workflow does nothing until it's merged to | ||
| # `master`. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: |
||
| on: | ||
| # zizmor flags `workflow_run` as a dangerous trigger because it runs with | ||
| # repo secrets in base-branch context. That's exactly why we use it here: | ||
| # this workflow never touches any PR-supplied code (no checkout, no script | ||
| # execution from the artifact — just cp/git on opaque corpus blobs), so | ||
| # the warning is a false positive. | ||
| workflow_run: # zizmor: ignore[dangerous-triggers] | ||
| workflows: ["Continuous Integration Checks"] | ||
| types: [completed] | ||
|
|
||
| permissions: | ||
| # download-artifact across runs requires `actions: read`. | ||
| actions: read | ||
|
|
||
| jobs: | ||
| push-corpus: | ||
| # Run on either success or fuzzer crash; skip on cancellation. | ||
| if: >- | ||
| github.event.workflow_run.conclusion == 'success' || | ||
| github.event.workflow_run.conclusion == 'failure' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Download fuzz corpus artifact | ||
| id: download | ||
| # The artifact only exists when the fuzz job got far enough to upload | ||
| # it. Don't fail this workflow if the upload was skipped. | ||
| continue-on-error: true | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: hfuzz-corpus | ||
| path: hfuzz-corpus | ||
| run-id: ${{ github.event.workflow_run.id }} | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Clone fuzzing corpus | ||
| if: steps.download.outcome == 'success' | ||
| run: git clone --depth=1 https://github.com/lightningdevkit/ldk-fuzzing-corpus.git | ||
|
|
||
| - name: Copy new corpus entries into the corpus checkout | ||
| if: steps.download.outcome == 'success' | ||
| run: | | ||
| set -eu | ||
| if [ -d hfuzz-corpus/rust-lightning ]; then | ||
| cp -rn hfuzz-corpus/rust-lightning/. ldk-fuzzing-corpus/rust-lightning/ | ||
| fi | ||
|
|
||
| - name: Open PR with new corpus entries | ||
| if: steps.download.outcome == 'success' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.CORPUS_PUSH_TOKEN }} | ||
| SOURCE_SHA: ${{ github.event.workflow_run.head_sha }} | ||
| RUN_URL: ${{ github.event.workflow_run.html_url }} | ||
| RUN_ID: ${{ github.event.workflow_run.id }} | ||
| run: | | ||
| set -eu | ||
| cd ldk-fuzzing-corpus | ||
| if [ -z "$(git status --porcelain)" ]; then | ||
| echo "No new corpus entries to contribute." | ||
| exit 0 | ||
| fi | ||
| if [ -z "${GH_TOKEN:-}" ]; then | ||
| echo "Found new corpus entries but CORPUS_PUSH_TOKEN is unset; skipping PR." | ||
| git status --short | ||
| exit 0 | ||
| fi | ||
| BRANCH="ci/new-corpus-${RUN_ID}" | ||
| git config user.email "ldk-ci@users.noreply.github.com" | ||
| git config user.name "LDK CI" | ||
| git checkout -b "$BRANCH" | ||
| git add rust-lightning | ||
| git commit \ | ||
| -m "Add corpus entries from rust-lightning CI" \ | ||
| -m "Source commit: ${SOURCE_SHA}" \ | ||
| -m "Run: ${RUN_URL}" | ||
| REMOTE=$(git config --get remote.origin.url) | ||
| PUSH_URL="https://x-access-token:${GH_TOKEN}@${REMOTE#https://}" | ||
| git push "$PUSH_URL" "HEAD:$BRANCH" | ||
| gh pr create \ | ||
| --title "New corpus entries from rust-lightning CI run ${RUN_ID}" \ | ||
| --body "Discovered while running fuzz CI against \`${SOURCE_SHA}\`. Source: ${RUN_URL}" \ | ||
| --head "$BRANCH" \ | ||
| --base master | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.