Source
yaml
id: weekly_confluence_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_confluence
type: io.kestra.plugin.confluence.pages.Update
apiToken: "{{ secret('CONFLUENCE_API') }}"
serverUrl: "{{ secret('CONFLUENCE_SERVER_URL') }}"
username: "{{ secret('EMAIL') }}"
pageId: "{{ secret('PAGE_ID') }}"
status: current
title: Weekly Recaps
markdown: |
## 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!
versionInfo:
number: "{{ kv('version_number') }}"
message: Weekly recap {{ now() | date("yyyy-MM-dd") }}
- id: increment_version_number
type: io.kestra.plugin.core.kv.Set
key: version_number
value: "{{ kv('version_number') + 1 }}"
kvType: NUMBER
- 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 Confluence.
This flow requires:
- A GitHub PAT
- Access to a Confluence instance
- Confluence instance URL
- Confluence API Token
- Confluence Page Id
- Google Workspace Service Account
- Google Calendar Id
- Slack Webhook URL
More Related Blueprints