Blueprints

Weekly recap of GitHub issues and Google Calendar meetings sent to Notion

Source

yaml
id: weekly-notion-recap
namespace: company.team

triggers:
  - id: weekly_wrapup
    type: io.kestra.plugin.core.trigger.Schedule
    # Austin @ 4pm Fridays
    cron: 0 16 * * 5
    conditions:
      - type: io.kestra.plugin.core.condition.Not
        conditions:
          - type: io.kestra.plugin.core.condition.PublicHoliday
            country: US

tasks:
  - id: get_issues
    type: io.kestra.plugin.core.http.Request
    uri: "https://api.github.com/orgs/kestra-io/issues?filter=assigned&state=closed\
      &since={{ now() | dateAdd(-5, 'DAYS') |
      date(\"yyyy-MM-dd'T'07:00:00-06:00\") }}"
    method: GET
    headers:
      Authorization: "Bearer {{ secret('CLASSIC_GITHUB') }}"
      Accept: application/vnd.github+json
      X-GitHub-Api-Version: 2022-11-28

  - id: for_each_issue
    type: io.kestra.plugin.core.flow.ForEach
    values: "{{ outputs.get_issues.body }}"
    tasks:
      - id: get_individual_issues
        type: io.kestra.plugin.core.debug.Return
        format: "{{ json(taskrun.value).url }} "
      - id: set_issues
        type: io.kestra.plugin.core.kv.Set
        key: issues_today
        value: "{{ taskrun.iteration + 1}}"
        kvType: NUMBER
        ttl: PT5M

  - id: get_calendar_events
    type: io.kestra.plugin.googleworkspace.calendar.ListEvents
    serviceAccount: "{{ secret('NEW_SA_GCAL') }}"
    calendarId: "{{ secret('CALENDARID') }}"
    #7AM US Central
    timeMin: "{{ now() | dateAdd(-5, 'DAYS') | date(\"yyyy-MM-dd'T'07:00:00-06:00\") }}"
    #5PM US Central
    timeMax: "{{ now() | date(\"yyyy-MM-dd'T'17:00:00-06:00\") }}"

  - id: for_each
    type: io.kestra.plugin.core.flow.ForEach
    values: "{{ outputs.get_calendar_events['metadataList'] }}"
    tasks:
      - id: get_individual_event
        type: io.kestra.plugin.core.debug.Return
        format: "{{ json(taskrun.value).htmlLink }}"
      - id: set_meetings
        type: io.kestra.plugin.core.kv.Set
        key: meetings_today
        value: "{{ taskrun.iteration + 1 }}"
        kvType: NUMBER
        ttl: PT5M

  - id: send_to_notion
    type: io.kestra.plugin.notion.page.Update
    apiToken: "{{secret('NOTION')}}"
    pageId: "{{secret('PAGE_ID_NOTION')}}"
    content: |
      # Weekly Recap {{ now() | date("yyyy-MM-dd") }}

      You went to {{ kv('meetings_today') }} meetings and closed {{ kv('issues_today') }} PR(s) or issue(s) on the Kestra org!

  - id: check_for_events
    type: io.kestra.plugin.core.flow.If
    condition: "{{ kv('meetings_today') != 0 }}"
    then:
      - id: send_meetings_to_slack
        type: io.kestra.plugin.slack.SlackIncomingWebhook
        url: "{{ secret('SLACK_WEBHOOK') }}"
        payload: |
          {
            "text": "You went to {{ kv('meetings_today') }} meetings and closed {{ kv('issues_today') }} PR(s) or issue(s)!"
          }
    else:
      - id: send_no_meetings_to_slack
        type: io.kestra.plugin.slack.SlackIncomingWebhook
        url: "{{ secret('SLACK_WEBHOOK') }}"
        payload: |
          {
            "text": "No meetings or GitHub activity this week."
          }

About this blueprint

Business

This flow looks for issues and PRs assigned to a specific user and closed in the last 5 days with the Kestra org. This flow also gets the last 5 days of meetings from Google Calendar. With this info, the flow then sends a message to Slack and Notion.

This flow requires:

  • A GitHub PAT
  • Access to a Notion instance
    • Notion API Token
    • Notion Page Id
  • Google Workspace Service Account
  • Google Calendar Id
  • Slack Webhook URL

Schedule

Not

Public Holiday

Request

For Each

Return

Set

List Events

Update

If

Slack Incoming Webhook

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra