Repository navigation
Conversation
… activity_type to event_type
- Introduces the IEventProcessorStrategy interface to define methods for handling events and processing payloads.
- Adds PushStrategy class implementing IEventProcessorStrategy - Defines canHandle method to identify 'push' events - Implements process method to transform TPushEventPayload into ContributionPayload[]
…sses - Added PRStrategy class to handle pull request events. - Introduced PRMergedEventHandler to process merged pull request actions. - Defined PRActionHandler interface for consistent event handling.
- Implemented creditAuthors function to process pull request authors. - Implemented creditReviewers function to process pull request reviewers. - Both functions currently throw an error indicating they are not implemented.
- Added the run function to handle GitHub event processing. - Utilizes the processors to determine the appropriate strategy based on the event type. - Logs the processed tracked events for further analysis.
…class - Added IExternalClient interface for sending contribution payloads. - Implemented ApicuronClient class that adheres to IExternalClient. - Prepared sendPayload method for future implementation of payload handling.
Extract User login, review state, and submission date to use as timestamp with fallback of date.now()
- TPushEventPayload -> GHPushEventPayload to indicate it's the GH produced payload not the action one.
… type of contribution events.
…ng to async execution
… input via core library
- Implements functionality to fetch closed PRs from GitHub. - Sends PR data as payload to a specified server endpoint. - Supports optional parameters for limiting results and dry runs. - Saves server responses to a JSON file.
- Deleted wait.ts and main.test.ts as they are no longer needed. - Cleaned up the test suite by removing unused test cases.
…amline user null check in process PR merge method - Ensures consistency in the payload structure by requiring a valid github_login. - This change may affect how the application handles user authentication and contributions. - Moved the null check for pull request user to the top of the process method for better readability. - Ensures that the error is thrown immediately if the user is null, preventing further execution.
- Moved try-catch block to encompass the entire run logic. - Ensured that errors during client initialization and processing are caught and handled properly.
…on dependancies - Previously relied on @github/local-action to pull them in as a dev dependency,
- Introduced fetchPullRequestSnapshot function to encapsulate logic for fetching pull request details. - Utilizes helper functions to transform data into the required snapshot format. - Reduces API calls by allowing prefetched data to be used when available.
- Introduced a new function to create unique event IDs for pull requests. - Utilizes UUID v5 for consistent ID generation based on repository and event details.
…ities - Adds functionality to build a pull request event with detailed activities. - Integrates helper functions to determine user types and account details. - Supports tracking of comments, reviews, and merges by human users.
- Introduced captureInfo function to encapsulate event tracking information. - Utilizes TRACKER_VERSION for versioning and formats observed_at for GitHub compatibility.
…plementation - moved IEventProcessorStrategy and IPRActionHandler interfaces. - Removed outdated PRStrategy and PREventHandler implementations to replace with new ones in the following commits. - Streamlined event handling structure for better maintainability.
- Added PRMergedEventHandler class to handle events for merged pull requests. - Integrated fetching of pull request snapshots and building event data. - Updated capture mode constants to use uppercase for consistency.
- Removed unused import from strategies. - Added GitHubClient and processors imports for clarity. - Changed trackedEvents initialization to default to an empty array.
- Implements a new script to list closed pull requests and capture events. - Utilizes GitHubClient to fetch closed PRs and their details. - Writes captured events to a specified output file in JSONL format.
- Enhanced TPullRequestActivity to include review_object_id for better tracking of review comments. - Updated fetchPullRequestSnapshot to map review_id correctly. - Adjusted TCommentSnapshot to accommodate optional review_id.
…er extraction - Deleted PRMergedEventHandler as it is no longer needed. - Removed getPullRequestReviewers function due to redundancy. - Eliminated extractAuthors function which was not implemented.
… schema - Updated version in package.json and version.ts to 0.3.1 - Introduced review_object_id in pull request schema for better tracking - Added envelope.json schema for event envelope structure - Created pull_request.strict.json for stricter validation of pull request data
…ling - Added `sendEvent` and `sendBatch` methods to handle event submissions. - Introduced `ApicuronRequestError` class for better error management. - Removed unused `IExternalClient` interface and related code. - Created `apicuron.types.ts` for type definitions related to API responses.
- Introduced apicuron-url and apicuron-token inputs for better API management. - Added dry-run option to allow event logging without sending to the API.
- Introduced dry-run validation to ensure apicuron-token is provided unless dry-run is true. - Simplified event handling by directly processing tracked events. - Improved logging for dry-run scenarios to enhance debugging.
…tion - Introduced BatchSender class to manage event queuing and sending to APICURON. - Updated backfill script to read APICURON configuration from environment variables. - Enhanced error handling for batch sending, including handling of oversized batches.
…events - Added stats parameter to track skipped events during processing. - Increment skipped count when an event is not yielded.
Format sources and action.yml, ignore generated schemas in prettier, and suppress the empty-interface rule on the two types used as schema sources. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The handler list was empty, so every run ended with no event to send. Also type the strategy payload as unknown instead of any. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main.ts reads github-token, but the input was dropped from action.yml. It now defaults to the workflow token. The CI self-test has no APICURON token, so it runs with dry-run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop the unused flat payload types, the unused context and push payload types, and the Python sender for the old payload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Set the real package name, author, repository links, code owner and licence holder. Remove the Copilot prompts, the licensed workflow and cache, and the coverage badge. Add rimraf as a dev dependency, drop unused ones, and list the real inputs in .env.example. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Explain why the event id inputs must not change, why activity after close is excluded, and that the action must never check out PR code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the template README with partner setup, inputs, dry-run, backfill, troubleshooting and a draft contributor notice. Update the example to the current inputs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Implement tests to validate the behavior of buildPullRequestEvent. - Ensure correct handling of merged and unmerged pull requests. - Verify exclusion of bot activities and proper sorting of events. - Test deep equality of events built from the same snapshot.
- Introduced a new snapshot file for pull request events. - Added functions to create snapshots, reviews, and comments. - Removed redundant code from tests by importing from the new snapshot.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Turns the TypeScript Action template on
maininto the contribution eventtracker. When a pull request is merged, the Action builds one CloudEvents 1.0
event describing who did what and sends it to APICURON, so contributors can be
credited. A backfill script produces the same events for past pull requests.
This is the first release. Partner repositories will reference the Action at
@main.How it works
pull_request_target(types: [closed])for merged pull requests.
conversation comments, review comments and closing issues are fetched
through the GitHub API (REST and GraphQL).
and backfill share it.
The event
it.unipd.biocomputingup.github.pull_request.merged.sourcegithub:repository:{numeric id},subjectpull_request/{number},dataschemaa w3id URI.idderived from repository id, PR number, event typeand
closed_at, so re-sending or backfilling the same PR gives the same id.datacontains:repositoryandpull_requestmetadata;activities[]: opened, reviewed (with state), commented (conversation orreview thread, with
review_object_id), merged;relationships[]: issues the PR closes;capture: tool, version, mode (live or backfill), observed time.closed_atis excluded, and activities,relationships and labels are sorted so output is reproducible.
Main parts
src/main.tssrc/processors/src/client/github/src/builders/src/client/apicuron-client/src/scripts/src/types/schemas/Action inputs
apicuron-tokendry-runapicuron-urlhttps://apicuron.org/apidry-runfalsegithub-tokenThere is deliberately no resource id input: the repository-to-resource link
lives in APICURON.
Delivery
POST /tracker-eventsfor one event,/tracker-events/batchfor several.dry-runis true.recognised as duplicates.
Backfill
yarn backfill <owner> <repo> [outFile]walks all merged pull requests, writesevery event to
backfill-{owner}-{repo}-{timestamp}.jsonl, and, whenAPICURON_TOKENis set, sends them in batches packed by size (about 900 KB,max 500 events) with split-and-retry on 413.
Also in this branch
yarn schema).already stored in APICURON.
draft contributor notice) and an example workflow.
Testing
dist/is built from the final source.BioComputingUP/disprot.Notes for reviewers
pull_request_targetis used so pull requests from forks can access thesecret. It is safe here because the Action only reads PR metadata through
the API and never checks out or runs PR code.
dataschemaURI does not resolve yet; the w3id redirect will berequested after this merge.
review.
known follow-up.
After merging
🤖 Generated with Claude Code