Send me a list of repos I've starred this week
@dylburger
code:
data:privatelast updated:10 months ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 200,000+ developers using the Pipedream platform
steps.
trigger
Cron Scheduler
Deploy to configure a custom schedule
This workflow runs on Pipedream's servers and is triggered on a custom schedule.
steps.
fetch_stars_since_time
auth
to use OAuth tokens and API keys in code via theauths object
params
Personal Access Token

Create a personal access token here with the read:user scope.

string ·params.personalAccessToken
Username
string ·params.username
Num Days Ago

The range of time (in number of days) to look back to check starred repos, e.g. enter 7 to find the repos you starred in the last week

7
string ·params.numDaysAgo
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across invocations with$checkpoint.
async (event, steps, params) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
}
18
const { Octokit } = require("@octokit/rest");
const octokit = new Octokit({
  auth: params.personalAccessToken,
})

const stars = await octokit.request(`GET /users/${params.username}/starred`, {
  headers: {
    Accept: "application/vnd.github.v3.star+json" // required to get starred_at
  }
})

const epochNDaysAgo = +new Date() - (params.numDaysAgo * 24 * 60 * 60 * 1000)
// export this param to make it available in the email step, as well
this.numDaysAgo = params.numDaysAgo

return stars.data.filter(star => +new Date(star.starred_at) > epochNDaysAgo)
steps.
format_subject_and_text
auth
to use OAuth tokens and API keys in code via theauths object
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across invocations with$checkpoint.
async (event, steps) => {
1
2
3
4
5
6
7
}
8
// This "exports" the data for use in future steps, which we'll reference in our email
this.subject = `${steps.fetch_stars_since_time.$return_value.length} repos starred in the past ${steps.fetch_stars_since_time.numDaysAgo} days`
this.html = steps.fetch_stars_since_time.$return_value.map(star => `<a href="${star.repo.html_url}">${star.repo.full_name}</a>`).join('<br />')

// text fallback where html isn't supported
this.text = steps.fetch_stars_since_time.$return_value.map(star => star.repo.full_name).join('\n')
steps.
email_me
Customize and send an email to the email address you registered with Pipedream. The email will be sent by notifications@pipedream.com.
params
Subject
{{steps.format_subject_and_text.subject}}
string ·params.subject
Text
{{steps.format_subject_and_text.text}}
string ·params.text
Html
{{steps.format_subject_and_text.html}}
string ·params.html
Optional
code
async params => {
1
2
3
4
5
6
7
8
9
10
11
12
}
13
const options = {
  subject: params.subject,
  text: params.text,
}
if (params.html) {
  options.html = params.html
}
if (params.include_collaborators) {
  options.include_collaborators = params.include_collaborators
}
$send.email(options)