Skip to content
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

A bot informing our community about new stuff #510

Open
haesleinhuepf opened this issue Nov 24, 2024 · 2 comments
Open

A bot informing our community about new stuff #510

haesleinhuepf opened this issue Nov 24, 2024 · 2 comments

Comments

@haesleinhuepf
Copy link
Member

We could combine the bluesky API, the Zenodo API and github workflows to submit a post on bluesky if a new record was published in a given Zenodo community ("nfdi4bioimage") during the last 24h. The workflow could run daily.

The code in scripts/auto-add-from-zenodo-communities.py could be useful for this and should be refactored to do this.

git-bob think about how to do this.

Copy link
Contributor

This message was generated by git-bob (version: 0.14.0, model: github_models:gpt-4o, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully.

To implement the requested feature, we can create a daily GitHub Actions workflow that checks for new Zenodo records and posts them to Bluesky. This will require integrating the Bluesky API with the existing script. Here’s a minimal proposal for the changes:

  1. Refactor scripts/auto-add-from-zenodo-communities.py:

    • Add functionality to post updates to Bluesky after new records are identified.

    Here’s an outline for the new function within the script:

    def post_to_bluesky(new_entries):
        """
        Post new Zenodo records to Bluesky.
        """
        for entry in new_entries:
            post_content = f"New Zenodo Record: {entry['name']} - {entry['url']}"
            # Call Bluesky API to post this content
            # This requires setting up authentication and making an API request
            # e.g., requests.post(bluesky_api_endpoint, data={'content': post_content}, headers=headers)
            pass

    In the main() function, after processing new data and before creating the pull request, call post_to_bluesky(new_data).

  2. Create New GitHub Workflow:

    • Add a daily schedule to initiate the updated script.
    name: Daily Zenodo to Bluesky
    
    on:
      schedule:
        - cron: '0 0 * * *'  # Runs daily at midnight
    
    jobs:
      post-zenodo-to-bluesky:
        runs-on: ubuntu-latest
    
        steps:
        - name: Checkout code
          uses: actions/checkout@v2
        
        - name: Set up Python
          uses: actions/setup-python@v4
          with:
            python-version: '3.x'
    
        - name: Install dependencies
          run: |
            python -m pip install --upgrade pip
            pip install -r requirements.txt
    
        - name: Run Zenodo to Bluesky script
          env:
            ZENODO_API_KEY: "${{ secrets.ZENODO_API_KEY }}"
            BLUESKY_API_KEY: "${{ secrets.BLUESKY_API_KEY }}"
          run: |
            python scripts/auto-add-from-zenodo-communities.py nfdi4bioimage/training
    

Ensure that the Bluesky API credentials are securely stored in the repository secrets. This setup should help automate the process of notifying your community about new records on Zenodo via Bluesky.

@haesleinhuepf
Copy link
Member Author

git-bob ask claude to comment on how to use the bluesky API for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant