Skip to content

πŸ“… 7/30 @ 9am PT - Running scheduled GitHub App tasks using ActionsΒ #38

@gr2m

Description

@gr2m

πŸ’πŸ» Running scheduled GitHub App tasks using Actions
πŸ“… Friday, July 30, 2021
πŸ• 9:00am Pacific Time (in your timezone)
πŸŽ™οΈ Hosted by @bdougie
πŸ“ https://www.twitch.tv/github
🏷️ Automation


Subscribe to this issues to get a notification before the show begins and a summary after the show concludes. You can also sign up for the event on https://www.meetup.com/Open-Sauced-Meetup/events/279608849

Running scheduled GitHub App tasks using Actions

opensauced.pizza is your dashboard to plan and track your Open Source contributions. It works by forking the open-sauced/goals-template repository, which includes the goals-caching.yml workflow to synchronize data every two days. Besides the workflow, the @open-sauced app is installed as well which acts on direct interactions with the repository.

In this show, we will try to remove the goals-caching.yml workflow from the template repository, and instead do the synchronization with the app, which is already installed. Apps do not have a native schedule trigger such as actions, but we can utilize a GitHub Action to authenticate as the app, and synchronize all repositories the app is installed on in one go.

Outline

  • show the current flow
    • Add a new repository, star repository, show out-of-sync stars in open sauced dashboard. Run sync using the scheduled sync action by adding a workflow_dispatch trigger
  • create sync flow using GitHub App
    • Create new workflow in open-sauced/open-sauced with a schedule trigger.
    • We will need to put a update-open-sauced-goals-cache.js somewhere in the repository, and we need to install octokit as dependency. We'll need to checkout the repository and setup Node 16 before running the script.
    • In the script, we will iterate all repositories of each installation. Load the data.json file for each repository, load the latest stats for each repository, then update the data.json file if there is any change.
    • Use @octokit/plugin-create-or-update-text-file to simplify the process of loading and updating the files
    • Optimization: batch load statistics for 100 repositories at once using a single GraphQL query
  • Bonus
    • create a script that creats pull request to all existing */open-sauced-goals repositories which removes the scheduled-caching.yml workflow file using octokit-plugin-create-pull-request

TODOs

Before the show

When show begins

After the show

Recording

will be added after the show

Shownotes

Metadata

Metadata

Assignees

No one assigned

    Labels

    showPreparation issue for a live show

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions