{"id":18993122,"url":"https://github.com/redbadger/square-the-circle","last_synced_at":"2025-04-22T11:48:50.219Z","repository":{"id":137878655,"uuid":"83700436","full_name":"redbadger/square-the-circle","owner":"redbadger","description":"CircleCI stats reporter","archived":false,"fork":false,"pushed_at":"2017-03-14T11:44:22.000Z","size":15648,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-17T00:18:35.383Z","etag":null,"topics":["circleci","nodejs","serverless"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redbadger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-03-02T16:36:55.000Z","updated_at":"2018-05-25T23:22:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"b4a6c05b-018d-4d61-9eac-4322e82368b8","html_url":"https://github.com/redbadger/square-the-circle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbadger%2Fsquare-the-circle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbadger%2Fsquare-the-circle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbadger%2Fsquare-the-circle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbadger%2Fsquare-the-circle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redbadger","download_url":"https://codeload.github.com/redbadger/square-the-circle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250237793,"owners_count":21397399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circleci","nodejs","serverless"],"created_at":"2024-11-08T17:19:55.191Z","updated_at":"2025-04-22T11:48:50.199Z","avatar_url":"https://github.com/redbadger.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Square the circle\n\nThis is a CircleCI builds statistics serverless lambda that runs on AWS. The report is sent out periodically to your chosen Slack channel.\n\nAt the moment we derive from CircleCI API the following stats:\n* Percentage of failed builds\n* Number of code deployments\n* Average Build time\n\n### Number of code deployments\n\nTo distinguish deployments from usual builds the script checks CircleCI `build_parameters` which can be set in your deployment script. `build_parameters` should containt `PRODUCTION` flag set to `true`.\n```\nbuild_parameters: { PRODUCTION: 'true' }\n```\n\n## Configuration\n\nMake sure your AWS credentials are properly configured on your machine. For more information head to [this page](https://serverless.com/framework/docs/providers/aws/guide/credentials/).\n\nCopy `src/config.example.js` to `src/config.js`\n```\ncp src/config.example.js src/config.js\n```\n\nEdit `src/config.js` and set your config variables\n```javascript\nconfig.circleCItoken = '123abc';\nconfig.slackEndpoint = 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX';\nconfig.organisationName = 'redbadger'; // Github account name\nconfig.projectName = 'website-honestly'; // Github repo name\nconfig.timeSpan = 7; // Report time span. 7 means weekly\n```\n\nCircleCI token can be obtained [here](https://circleci.com/account/api).\nFor Slack webook endpoint head to [this page](https://api.slack.com/incoming-webhooks)\n\nBy default the report is scheduled every week on Monday at 9:00 am. If you want to change it you should head to `serverless.yml` file. The schedule is configured in [AWS cron format](http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions).\n\n```\nfunctions:\n  stats:\n    handler: dist/index.handler\n    events:\n      - schedule: cron(0 9 ? * 2 *)\n```\n\n## Setup\n\nRun:\n```\nnpm install\nnpm run deploy\n```\n\nThe expected result should be similar to:\n```\nsrc/config.js -\u003e dist/config.js\nsrc/getStats.js -\u003e dist/getStats.js\nsrc/index.js -\u003e dist/index.js\nServerless: Packaging service...\nServerless: Uploading CloudFormation file to S3...\nServerless: Uploading service .zip file to S3 (14.24 MB)...\nServerless: Updating Stack...\nServerless: Checking Stack update progress...\n.........\nServerless: Stack update finished...\nServerless: Removing old service versions...\nService Information\nservice: square-the-circle\nstage: dev\nregion: us-east-1\napi keys:\n  None\nendpoints:\n  None\nfunctions:\n  stats: square-the-circle-dev-stats\n\n```\n\nAfter that your new scheduled lambda is ready.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredbadger%2Fsquare-the-circle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredbadger%2Fsquare-the-circle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredbadger%2Fsquare-the-circle/lists"}