GitXplorerGitXplorer
k

gh-repositories-action

public
1 stars
0 forks
3 issues

Commits

List of commits on branch main.
Unverified
6b55339ef81129f8f02e4e1608b7ed9b2087c45e

update to the report

kkarpikpl committed 4 months ago
Verified
b5586d70d227396ca8af48de7cfbdd4f6986f0a6

fix delimiter

kkarpikpl committed 5 months ago
Verified
a103cc0c20c09b6256ccae06ea5fcb741699c52f

permissions

kkarpikpl committed 5 months ago
Unverified
9dc13d665fd3fd3de9bc3f920d4673b1ae07d5c5

error logging

kkarpikpl committed 5 months ago
Unverified
79a03007750dfe67b540923f34e6a2aa2721c4be

new delimiter

kkarpikpl committed 5 months ago
Verified
ec737bcfd9abd2aa63e39e80f92acc4d3d778afc

fix readme

kkarpikpl committed 5 months ago

README

The README file for this repository.

Get a report about repositories in the organization

GitHub Super-Linter CI Check dist/ CodeQL Coverage

Produce a CSV file with information about repositories. 🚀

Usage

Reading repositories information requires following permissions:

  • Read access to actions, administration, code, environments, metadata, and secrets

that cannot be granted to a workflow. Please either use a PAT or Application token:

  • Make sure provided PAT has the appropriate scope for the organization the action is used for.

or

Using PAT

steps:
  - name: GH Repositories Report
    id: gh_repo_report
    uses: karpikpl/gh-repositories-action@v1
    with:
      github-org: your-org-name
      github-pat: ${{ secrets.PAT_NAME_HERE }}

Using App token

- uses: actions/create-github-app-token@v1
  id: app-token
  with:
    app-id: ${{ vars.APP_ID }}
    private-key: ${{ secrets.PRIVATE_KEY }}

- name: GH Repositories Report
  id: gh_repo_report
  uses: karpikpl/gh-repositories-action@v1
  with:
    github-org: your-org-name
    github-pat: ${{ steps.app-token.outputs.token }}

Detailed example

Example with report upload and action summary.

name: Create Repositories Report

on:
  # Run automatically when main updated
  push:
    branches:
      - main
  # Run nightly at 5a UTC / 11p CT
  schedule:
    - cron: '0 5 * * *'
  # Permit manual trigger
  workflow_dispatch:

jobs:
  get_repositories_report:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - uses: actions/create-github-app-token@v1
        id: app-token
        with:
          app-id: ${{ vars.APP_ID }}
          private-key: ${{ secrets.PRIVATE_KEY }}

      - name: GH Repositories Report
        id: gh_repo_report
        uses: karpikpl/gh-repositories-action@v1
        with:
          github-org: your-org-name
          github-pat: ${{ steps.app-token.outputs.token }}

      # upload artifacts
      - name: Upload repositories report
        uses: actions/upload-artifact@v4
        with:
          name: gh-repo-report
          path: ${{ steps.gh_repo_report.outputs.file }}

      # create a github summary using github script
      - name: Add Summary
        uses: actions/github-script@v7
        with:
          script: |
            const fs = require('fs');
            // read summary file
            const data = fs.readFileSync('${{ steps.gh_repo_report.outputs.file }}', 'utf8');
            const csv = data.split('\n').map(row => row.split(';'))
            // header
            for (let i = 0; i < csv[0].length; i++) {
                csv[0][i] = { data: csv[0][i], header: true };
            }

            await core.summary
            .addHeading('GH repositories data')
            .addTable(csv)
            .write()

Inputs

github-pat

Required GitHub personal access token or application token with Read access to actions, administration, code, environments, metadata, and secrets

github-org

Required Name of the GitHub organization.

Outputs

file

Name of the CSV file