Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to run github action on linux runner and fix token issue #12

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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