Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A GitHub Action to generate a report that contains code frequency metrics and programming languages used per repository belonging to a GitHub organization.

License

NotificationsYou must be signed in to change notification settings

nicklegan/github-org-code-frequency-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

A GitHub Action to generate a report that contains code frequency metrics and programming languages used per repository belonging to a GitHub organization.

Usage

The exampleworkflow below runs on a monthlyschedule using the amount of weeks as an interval set in the workflow (default 4 weeks) and alternatively can also be triggered manually using aworkflow_dispatch event.

name:Code Frequency Actionon:schedule:# Runs on the first day of the month at 00:00 UTC##        ┌────────────── minute#        │ ┌──────────── hour#        │ │ ┌────────── day (month)#        │ │ │ ┌──────── month#        │ │ │ │ ┌────── day (week)    -cron:'0 0 1 * *'workflow_dispatch:inputs:fromdate:description:'Optional interval start date (format: yyyy-mm-dd)'required:false# Skipped if workflow dispatch input is not providedtodate:description:'Optional interval end date (format: yyyy-mm-dd)'required:false# Skipped if workflow dispatch input is not providedjobs:code-frequency-report:runs-on:ubuntu-lateststeps:      -name:Checkoutuses:actions/checkout@v3      -name:Code Frequency Reportuses:nicklegan/github-org-code-frequency-action@v2.1.0with:token:${{ secrets.ORG_TOKEN }}fromdate:${{ github.event.inputs.fromdate }}# Used for workflow dispatch inputtodate:${{ github.event.inputs.todate }}# Used for workflow dispatch input# org: ''# weeks: '4'# sort: 'additions'# sort-order: 'desc'# json: 'false'# appid: ${{ secrets.APPID }}# privatekey: ${{ secrets.PRIVATEKEY }}# installationid: ${{ secrets.INSTALLATIONID }}

GitHub secrets

NameValueRequired
ORG_TOKENArepo,read:orgscopedPersonal Access Tokentrue
ACTIONS_STEP_DEBUGtrueEnables diagnostic loggingfalse

💡 Disabletoken expiration to avoid failed workflow runs when running on a schedule.

Action inputs

NameDescriptionDefaultOptionsRequired
orgOrganization different than workflow contextfalse
weeksAmount of weeks in the past to collect data for(weeks start on Sunday 00:00:00 GMT)4false
sortColumn used to sort the acquired code frequency dataadditionsrepoName, additions, deletions, alltimeAdditions, alltimeDeletions, primaryLanguage, createdDatefalse
sort-orderSelected column sorting directiondescdesc, ascfalse
jsonGenerate an additional report in JSON formatfalsetrue, falsefalse
committer-nameThe name of the committer that will appear in the Git historygithub-actionsfalse
committer-emailThe committer email that will appear in the Git historygithub-actions@github.comfalse

Workflow dispatch inputs

The additional option to retrieve code frequency data using a custom date interval.If the below fields are left empty duringworkflow dispatch input, the default interval option of set weeks from the current date configured inmain.yml will be used instead.

💡 The result data includes the weeks which have their start date(Sunday 00:00:00 GMT) within the set interval.

NameValueRequired
Optional interval start dateA date matching the formatyyyy-mm-ddfalse
Optional interval end dateA date matching the formatyyyy-mm-ddfalse

CSV/JSON layout

The results of the 2nd and 3rd report column will be the sum of code frequency date for the selected interval per organization repository.

ColumnJSONDescription
RepositoryrepoNameOrganization owned repository
Lines added (interval)additionsNumber of lines of code added during set interval
Lines deleted (interval)deletionsNumber of lines of code deleted during set interval
All time lines addedalltimeAdditionsNumber of lines of code added since repo creation
All time lines deletedalltimeDeletionsNumber of lines of code deleted since repo creation
Primary languageprimaryLanguageThe primary programming language used in the repo
All languagesallLanguagesAll programming languages used in the repo
Repo creation datecreatedDateDate the repo has been created

A CSV report file to be saved in the repositoryreports folder using the following naming format:organization-date-interval.csv.

GitHub App authentication

As an alternative you can use GitHub App authentication to generate the report.For larger organizations it is recommended to use this method as more API requests per hour are allowed which will avoid running intorate limit errors.

Register a new organization/personal owned GitHub App with the below permissions:

GitHub App PermissionAccess
Repository Permissions:Contentsread and write
Organization Permissions:Administrationread

After registration install the GitHub App to your organization. Store the below App values as secrets.

GitHub App secrets

NameValueRequired
APPIDGitHub App ID numbertrue
PRIVATEKEYContent of private key .pem filetrue
INSTALLATIONIDGitHub App installation ID numbertrue

About

A GitHub Action to generate a report that contains code frequency metrics and programming languages used per repository belonging to a GitHub organization.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp