Skip to content

namipey/gha-usage-fetcher

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

Repository files navigation

gha-usage-fetcher

GitHub Action for fetching GitHub Action's usage.

Usage

In order to use this action, you need to:

  1. Register new GitHub App and add permission(admin:org=read)
  2. Store the App's ID in your repository environment variables (example: APP_ID)
  3. Store the App's private key in your repository secrets (example: PRIVATE_KEY)
steps:
  - name: Checkout
    id: checkout
    uses: actions/checkout@v4

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

  - name: Fetch GHA Usage
    id: gha-usage-fetcher
    uses: namipey/gha-usage-fetcher@v1
    with:
      github_token: ${{ steps.app-token.outputs.token }}
      org_name: ${{ github.repository_owner }}

  - name: Print Output
    run: echo "${{ steps.gha-usage-fetcher.outputs.total_cost }}"