Skip to content

Commit

Permalink
Merge pull request #12 from bfrancom/master
Browse files Browse the repository at this point in the history
Add option to run github action on linux runner and fix token issue
  • Loading branch information
benbalter authored Mar 25, 2024
2 parents d3d6212 + f19e419 commit 362a1a7
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
59 changes: 59 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Get Lines of Code for GitHub Organizations
on:
workflow_dispatch:
inputs:
test_org_name:
description: 'Name of the TEST environment GitHub Organization(s)'
required: true
default: ''
prod_org_name:
description: 'Name of the PROD environment GitHub Organization(s)'
required: true
default: ''
env:
GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }}
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: 3.0

- name: Install Dependencies and Cleanup
run: sudo apt-get install -y cloc

- name: Calculating LoC for each org
run: |
IFS=',' read -ra ORGS <<< "${{ github.event.inputs.test_org_name }}"
for org in "${ORGS[@]}"; do
bundle exec ruby loc.rb "$org"
done
prod:
timeout-minutes: 60
needs: test
#May need to add a "Pay as you go", larger GitHub-hosted runner depending on the size of each repo
#See https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners/about-larger-runners
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: 3.0

- name: Install Dependencies and Cleanup
run: sudo apt-get install -y cloc

- name: Calculating LoC for each org
run: |
IFS=',' read -ra ORGS <<< "${{ github.event.inputs.prod_org_name }}"
for org in "${ORGS[@]}"; do
bundle exec ruby loc.rb "$org"
done
2 changes: 2 additions & 0 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
description: 'The org (or user) to calculate total lines of code'
required: false
type: string
env:
GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }}
jobs:
run:
runs-on: macos-latest
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Don't want to set up a local development environment? You can run this script vi

You'll see the progress and count(s) in the job output (also available from the Actions tab).

Note: If you'd like to count private repositories, as described below, you'll need to set a `GITHUB_TOKEN` GitHub Actions secret.
Note: If you'd like to count private repositories, as described below, you'll need to set an `ORG_GITHUB_TOKEN` GitHub Actions secret with your PAT.

## How it works

Expand Down

0 comments on commit 362a1a7

Please sign in to comment.