forked from huggingface/ratchet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request huggingface#199 from officialcjunior/ratbot-use-tokei
ratbot workflow: replace `scc` with `tokei`
- Loading branch information
Showing
1 changed file
with
11 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,28 +9,29 @@ jobs: | |
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get the lines of code | ||
id: scc | ||
uses: iryanbell/[email protected] | ||
with: | ||
args: ${{ env.workspace }} -irs | ||
|
||
- name: Write output to a file | ||
- name: Install Rust and Cargo | ||
run: | | ||
echo "${{ steps.scc.outputs.scc }}" > scc_output.txt | ||
curl -sSf https://sh.rustup.rs | sh -s -- -y | ||
source $HOME/.cargo/env | ||
- name: Install Tokei | ||
run: cargo install tokei | ||
|
||
- name: Run Tokei and get the lines of code | ||
run: tokei crates/ratchet-core > tokei_output.txt | ||
|
||
- name: Comment or Update PR | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const fs = require('fs'); | ||
const sccOutput = fs.readFileSync('scc_output.txt', 'utf8'); | ||
const tokeiOutput = fs.readFileSync('tokei_output.txt', 'utf8'); | ||
const uniqueIdentifier = 'Code Metrics Report'; | ||
const codeReport = ` | ||
<details> | ||
<summary>${uniqueIdentifier}</summary> | ||
<pre> | ||
${sccOutput} | ||
${tokeiOutput} | ||
</pre> | ||
</details> | ||
`; | ||
|