Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

added example of github actions#915

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
ROHANDWIVEDI2005 wants to merge2 commits intogoogle-gemini:main
base:main
Choose a base branch
Loading
fromROHANDWIVEDI2005:update

Conversation

@ROHANDWIVEDI2005
Copy link
Contributor

  • Added an example of a txt to markdown converter github action
  • Demonstrates the use of gemini api in github-action work flows.

@github-actionsgithub-actionsbot added status:awaiting reviewPR awaiting review from a maintainer component:examplesIssues/PR referencing examples folder labelsAug 26, 2025
Copy link
Contributor

@gemini-code-assistgemini-code-assistbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Summary of Changes

Hello@ROHANDWIVEDI2005, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new example of a GitHub Action designed to automate the conversion of plain text files into well-structured Markdown documents. It leverages the Gemini API to intelligently format the text, streamlining the process of generating documentation likeREADME.md files within a repository.

Highlights

  • New GitHub Action Example: Adds a complete example of a GitHub Action that converts plain text (source.txt) into a formatted Markdown file (README.md).
  • Gemini API Integration: Demonstrates the use of the Gemini API within a GitHub Actions workflow for AI-powered text formatting and structuring.
  • Automated Documentation: Enables automated generation and updating ofREADME.md files, reducing manual effort in documentation maintenance.
  • Setup and Usage Documentation: Includes comprehensivereadme.md files detailing how to set up and use the new GitHub Action, including API key management and repository permissions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on ourdocumentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either/gemini <command> or@gemini-code-assist <command>. Below is a summary of the supported commands.

FeatureCommandDescription
Code Review/gemini reviewPerforms a code review for the current pull request in its current state.
Pull Request Summary/gemini summaryProvides a summary of the current pull request in its current state.
Comment@gemini-code-assistResponds in comments when explicitly tagged, both in issue comments and review comments.
Help/gemini helpDisplays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a.gemini/ folder in the base of the repository. Detailed instructions can be foundhere.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on@gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign uphere.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with theGemini Code Assist IDE Extension.

Footnotes

  1. Review thePrivacy Notices,Generative AI Prohibited Use Policy,Terms of Service, and learn how to configure Gemini Code Assist in GitHubhere. Gemini can make mistakes, so double check it anduse code with caution.

Copy link
Contributor

@gemini-code-assistgemini-code-assistbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Code Review

This pull request adds a helpful example of a GitHub Action that uses the Gemini API to convert a text file to Markdown. The implementation is a good start, but there are several areas for improvement in the Python script, the GitHub workflow configuration, and the documentation.

My review focuses on:

  • Python Script: Improving robustness by using more specific exception handling, enhancing reusability with command-line arguments instead of hardcoded filenames, and adhering to the project's Python style guide.
  • GitHub Workflow: Updating outdated actions and correcting the branch configuration to ensure it works correctly for pull requests and feature branches.
  • Documentation: Fixing a broken link and improving the clarity of the setup instructions.



return response.text
except Exception as e:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

high

Catching a genericException is too broad and can hide bugs or prevent specific error handling. It's better to catch more specific exceptions, such as those fromgoogle.api_core.exceptions, to handle potential API errors more precisely.

Comment on lines +45 to +46
input_file = "source.txt" # You can change this to your input file
output_file = "README.md" # You can change this to your desired output file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

high

Hardcoding filenames makes the script less reusable and can lead to accidentally overwriting important files like the mainREADME.md. It's better to accept file paths as command-line arguments, for example, by using Python'sargparse module.

uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'Auto-generate README.md from source.txt'
branch: main No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

high

Hardcodingbranch: main will prevent this action from working correctly on pull requests or feature branches. Thegit-auto-commit-action defaults to committing to the current branch, which is the desired behavior here. Please remove this line to allow the action to work on any branch. Also, the file is missing a final newline.

Because the workflows run on GitHub's servers, they have direct access to your repository's files and can use secrets to securely handle your API keys. This creates a powerful, hands-off automation system.

## Examples
* [AI Text to Markdown Converter](./ai-markdown-converter/README.md) No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

high

This link appears to be broken. The directory for the example ismarkdown-converter, notai-markdown-converter.

Suggested change
*[AI Text to Markdown Converter](./ai-markdown-converter/README.md)
*[AI Text to Markdown Converter](./markdown-converter/readme.md)

def convert_to_markdown(text_content,api_key):


client = genai.Client(api_key = api_key)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

medium

According to the Google Python Style Guide, which this project follows, there should be no spaces around the= sign for keyword arguments.1

Suggested change
client=genai.Client(api_key=api_key)
client=genai.Client(api_key=api_key)

Style Guide References

Footnotes

  1. The project's style guide specifies the use of the Google Python Style Guide.(link)

print("Markdown conversion failed.")

if __name__ == "__main__":
main() No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

medium

The file is missing a final newline, which is a standard convention for text files.

Suggested change
main()
main()

Comment on lines +28 to +51
uses: actions/checkout@v3


- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'


- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install google-genai


- name: Run Markdown Converter Script
run: python convert_to_md.py
env:

GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}


- name: Commit and Push Changes
uses: stefanzweifel/git-auto-commit-action@v4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

medium

Several of the GitHub Actions used in this workflow are outdated. It's recommended to update them to their latest major versions to benefit from new features, performance improvements, and security patches:

  • actions/checkout@v3 should beactions/checkout@v4
  • actions/setup-python@v4 should beactions/setup-python@v5
  • stefanzweifel/git-auto-commit-action@v4 should bestefanzweifel/git-auto-commit-action@v5

Comment on lines +23 to +26
* **`convert_to_md.py`**: This script contains the logic for the AI conversion.
* **`.github/workflows/generate-markdown.yml`**: This YAML file defines the GitHub Action workflow.

* **`structure of the repository`**:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

medium

The formatting of this list is a bit confusing. The last item, 'structure of the repository', seems like it should be a sub-heading or regular text rather than a bullet point in the list of files.

Suggested change
***`convert_to_md.py`**: This script contains the logic for the AI conversion.
***`.github/workflows/generate-markdown.yml`**: This YAML file defines the GitHub Action workflow.
***`structure of the repository`**:
***`convert_to_md.py`**: This script contains the logic for the AI conversion.
***`.github/workflows/generate-markdown.yml`**: This YAML file defines the GitHub Action workflow.
**Repository Structure**:

2. Add your plain text content to `source.txt`.
3. Commit and push your changes.

The workflow will run automatically, and you will see a new `README.md` file created with the formatted Markdown content. No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

medium

Please add a newline at the end of the file. It's a standard convention for text files.

Suggested change
The workflow will run automatically, and you will see a new`README.md` file created with the formatted Markdown content.
The workflow will run automatically, and you will see a new`README.md` file created with the formatted Markdown content.

Because the workflows run on GitHub's servers, they have direct access to your repository's files and can use secrets to securely handle your API keys. This creates a powerful, hands-off automation system.

## Examples
* [AI Text to Markdown Converter](./ai-markdown-converter/README.md) No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

medium

Please add a newline at the end of the file. It's a standard convention for text files.

Suggested change
*[AI Text to Markdown Converter](./ai-markdown-converter/README.md)
*[AI Text to Markdown Converter](./ai-markdown-converter/README.md)

@ROHANDWIVEDI2005
Copy link
ContributorAuthor

Resolves issue#911

@ROHANDWIVEDI2005ROHANDWIVEDI2005 marked this pull request as draftAugust 28, 2025 14:51
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@gemini-code-assistgemini-code-assist[bot]gemini-code-assist[bot] left review comments

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

component:examplesIssues/PR referencing examples folderstatus:awaiting reviewPR awaiting review from a maintainer

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@ROHANDWIVEDI2005

[8]ページ先頭

©2009-2025 Movatter.jp