diff --git a/.astro/types.d.ts b/.astro/types.d.ts index b999aa3f..77af046a 100644 --- a/.astro/types.d.ts +++ b/.astro/types.d.ts @@ -524,6 +524,13 @@ declare module 'astro:content' { collection: "projects"; data: InferEntrySchema<"projects"> } & { render(): Render[".md"] }; +"upwork_github_action_app.md": { + id: "upwork_github_action_app.md"; + slug: "github-action-and-github-app"; + body: string; + collection: "projects"; + data: InferEntrySchema<"projects"> +} & { render(): Render[".md"] }; "upwork_leadcrm.md": { id: "upwork_leadcrm.md"; slug: "leadcrm"; diff --git a/src/content/projects/upwork_github_action_app.md b/src/content/projects/upwork_github_action_app.md new file mode 100644 index 00000000..bba7b16e --- /dev/null +++ b/src/content/projects/upwork_github_action_app.md @@ -0,0 +1,87 @@ +--- +title: GitHub Action & GitHub App +slug: github-action-and-github-app +startDate: 2024-02-01 +endDate: 2024-02-18 +stacks: [Python, Lambda, DynamoDB, GitHub, GitHub-Action, GitHub-App] +company: upwork + +--- + +This project evolved through several iterations, each marked by specific enhancements and the introduction of new features. Below is a detailed account of these versions, highlighting the key concepts, changes, and technical implementations. + +### Version 1 (Feb 1, 2024 - Feb 2, 2024) +
+Key concepts in Version 1 + +In the initial version, I developed a GitHub Action workflow designed to activate upon every push to the repository and each pull request. The primary objectives were to execute coverage and linter checks for a Rust project, capture these outputs, and automatically comment on the pull request with the results. This workflow was successfully implemented and rigorously tested within the repository. [1](https://github.com/yubrew/ac-outpost/blob/main/.github/workflows/pr-tasks.yml). +
+ +### Version 2 (Feb 4, 2024 - Feb 10, 2024) +
+Key Changes in Version 2 + +- Significant advancements were made in this iteration: +- A new GitHub Action workflow, `ai-audit.yml`, was created to operate on every push and pull request, enhancing our project's automation and integration capabilities. [2](https://github.com/yubrew/ac-outpost/blob/main/.github/workflows/ai-audit.yml) + +- A key task was to aggregate all Rust files following a specified schema, excluding any that matched defined patterns ('test', 'schema'). This was achieved through a straightforward shell script, which efficiently processed and prepared these files for further analysis. + - Note: I am sharing these files because they are on a public repo. + - I've done this with a simple shell script below: + +
+ rust_file_aggregator.sh + + ```sh + #!/bin/bash + + # Initialize the file + echo "" > rust.md + + # Find all the Rust files in the current directory + # and its subdirectories. + # and iterate over the files + find . -name "*.rs" | while read file; do + # Check if the file name matches the exclusion patterns + # ['test', 'schema'] + if [[ $file != *test* && $file != *schema* ]]; then + # Print the file name + echo "Processing file: $file" + # Append the file name to the output file + echo "### FILE: $(basename $file)" >> rust.md + # Append the file content to the output file + cat $file >> rust.md + fi + done + ``` +
+ + - These files were then transmitted to a mock API endpoint (Which I created), crafted using AWS Lambda and DynamoDB, demonstrating a practical application of serverless technologies in automating code review processes. + +- Additionally, a `webhook` workflow was set up to trigger upon receiving webhook events [3](https://github.com/yubrew/ac-outpost/blob/main/.github/workflows/webhook.yml), further integrated with two AWS Lambda functions for dynamic API simulation `API-CRON` and repository data management `Webhook`. + - `API-CRON` Which was part of Mock API to randomly simulate the API behavior. + - `Webhook` Which reads data from the DynamoDB and add comment to the PR. + + +
+ +### Version 3 (Feb 12, 2024- Feb 18, 2024) +
+Key Changes in Version 3 + +This phase marked a significant shift in the project's direction, with the introduction of a GitHub App and Webhook, both hosted on AWS Lambda, showcasing a complex, integrated development environment: + +- The flow of that GitHub was as follow: + - The user will install the GitHub App on their repository. + - The GitHub App webhook will be triggered by the GitHub event. + - The GitHub App will send the data to the AWS Lambda. + - The AWS Lambda will process the data, save to the DynamoDB and commit the required file and secrets to the repository. + - `ai-audit.yml` and `rust_file_aggregator.sh` will be committed to the repository. + - The `MOCK API` url will be saved to the repository secrets. +- The `version 2` Lambda was used as it is just updated the following: + - The `webhook` Lambda updated to update the comment on the PR with the data from the Mock API. +- The new Lambda `GithubAppWebhook` added to handle the GitHub App webhook event. + +
+ +### Lessons Learned +- How to create GitHub App and seemelessly integrate webhook with it that hosted on AWS Lambda.