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

Fix render README action #444

Merged
merged 34 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a465831
fix render README action
jdhoffa Jan 30, 2024
8eaa02b
Test
jdhoffa Jan 30, 2024
7248309
try without renv
jdhoffa Jan 30, 2024
aae5a49
test
jdhoffa Jan 30, 2024
0057931
Add setup-r-dependencies
jdhoffa Jan 30, 2024
d852cbb
test
jdhoffa Jan 30, 2024
f46f8af
Re-build Rmarkdown files
jdhoffa Jan 30, 2024
c912661
Update .github/workflows/render-readme.yaml
jdhoffa Jan 30, 2024
f8add37
remove test FIXME
jdhoffa Jan 30, 2024
2b4e124
Merge branch 'fix_readme_action' of github.com:RMI-PACTA/r2dii.match …
jdhoffa Jan 30, 2024
d79551f
Re-build Rmarkdown files
jdhoffa Jan 30, 2024
b3fcbaf
run on macOS-latest to make it faster
jdhoffa Jan 30, 2024
6531a45
Merge branch 'fix_readme_action' of github.com:RMI-PACTA/r2dii.match …
jdhoffa Jan 30, 2024
77983fd
test
jdhoffa Jan 30, 2024
422d774
revert to using renv
jdhoffa Jan 30, 2024
438d562
install the local package
jdhoffa Jan 30, 2024
4c667a2
revert to using setup-r-dependencies
jdhoffa Jan 30, 2024
c458bc8
test
jdhoffa Jan 30, 2024
1a95c59
Update .github/workflows/render-readme.yaml
jdhoffa Jan 30, 2024
9862d40
test
jdhoffa Jan 30, 2024
d404efc
Merge branch 'fix_readme_action' of github.com:RMI-PACTA/r2dii.match …
jdhoffa Jan 30, 2024
8d5ccbe
fix R script calls
jdhoffa Jan 30, 2024
7097813
test
jdhoffa Jan 30, 2024
c22f6d6
Re-build Rmarkdown files
jdhoffa Jan 30, 2024
2f0c031
remove test
jdhoffa Jan 30, 2024
0e16bc3
Merge branch 'fix_readme_action' of github.com:RMI-PACTA/r2dii.match …
jdhoffa Jan 30, 2024
df250ba
revert me: pause R cmd checks
jdhoffa Jan 30, 2024
3787f52
use macos-latest
jdhoffa Jan 30, 2024
d22fe76
test
jdhoffa Jan 30, 2024
908acdf
Re-build Rmarkdown files
jdhoffa Jan 30, 2024
9d48901
remove test
jdhoffa Jan 30, 2024
bd091af
Merge branch 'fix_readme_action' of github.com:RMI-PACTA/r2dii.match …
jdhoffa Jan 30, 2024
63cfc62
Revert "revert me: pause R cmd checks"
jdhoffa Jan 30, 2024
7056bb2
undo test
jdhoffa Jan 30, 2024
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
47 changes: 25 additions & 22 deletions .github/workflows/render-readme.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
paths:
- README.Rmd
paths: ['README.Rmd']

name: Render README
name: render-readme

jobs:
render:
name: Render README
runs-on: macOS-latest
render-readme:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-pandoc@v1
- name: Install r2dii.data, rmarkdown, remotes, and the local package
run: |
install.packages("r2dii.data")
install.packages("remotes")
remotes::install_local(".")
remotes::install_cran("rmarkdown")
shell: Rscript {0}
- name: Render README
run: Rscript -e 'rmarkdown::render("README.Rmd")'
- name: Commit results
- name: Checkout repo
uses: actions/checkout@v3
jdhoffa marked this conversation as resolved.
Show resolved Hide resolved
with:
fetch-depth: 0

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2

- uses: r-lib/actions/setup-r-dependencies@v2

- name: Render README.Rmd file and Commit Results
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git commit README.md -m 'Re-build README.Rmd' || echo "No changes to commit"
README_PATH=($(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep 'README.Rmd$'))
Rscript -e 'for (f in commandArgs(TRUE)) if (file.exists(f)) rmarkdown::render(f)' ${README_PATH[*]}
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git commit ${README_PATH[*]/.Rmd/.md} -m 'Re-build Rmarkdown files' || echo "No changes to commit"
git push origin || echo "No changes to commit"
2 changes: 2 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ knitr::opts_chunk$set(
[![R-CMD-check](https://github.com/RMI-PACTA/r2dii.match/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/RMI-PACTA/r2dii.match/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

FIXME: This is just a test, delete me! foo bar baz

These tools implement in R a fundamental part of
the software PACTA (Paris Agreement Capital Transition Assessment),
which is a free tool that calculates the alignment between financial
Expand Down
73 changes: 36 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ coverage](https://codecov.io/gh/RMI-PACTA/r2dii.match/branch/main/graph/badge.sv
[![R-CMD-check](https://github.com/RMI-PACTA/r2dii.match/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/RMI-PACTA/r2dii.match/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

FIXME: This is just a test, delete me! foo bar baz

These tools implement in R a fundamental part of the software PACTA
(Paris Agreement Capital Transition Assessment), which is a free tool
that calculates the alignment between financial portfolios and climate
Expand Down Expand Up @@ -58,26 +60,26 @@ and run fuzzy matching against all company names in the `abcd`:
``` r
match_result <- match_name(loanbook_demo, abcd_demo)
match_result
#> # A tibble: 26 × 28
#> id_direct_loantaker name_direct_loantaker id_intermediate_parent_1
#> <chr> <chr> <chr>
#> 1 C26 large oil and gas company four <NA>
#> 2 C26 large oil and gas company four <NA>
#> 3 C1 large automotive company five <NA>
#> 4 C1 large automotive company five <NA>
#> 5 C35 large steel company five <NA>
#> 6 C35 large steel company five <NA>
#> 7 C5 large automotive company two <NA>
#> 8 C5 large automotive company two <NA>
#> 9 C30 large power company five <NA>
#> 10 C30 large power company five <NA>
#> # ℹ 16 more rows
#> # ℹ 25 more variables: name_intermediate_parent_1 <chr>,
#> # A tibble: 307 × 28
#> id_loan id_direct_loantaker name_direct_loantaker id_intermediate_pare…¹
#> <chr> <chr> <chr> <chr>
#> 1 L1 C294 Vitale Group <NA>
#> 2 L3 C292 Rowe-Rowe IP5
#> 3 L5 C305 Ring AG & Co. KGaA <NA>
#> 4 L6 C304 Kassulke-Kassulke <NA>
#> 5 L6 C304 Kassulke-Kassulke <NA>
#> 6 L7 C227 Morissette Group <NA>
#> 7 L7 C227 Morissette Group <NA>
#> 8 L8 C303 Barone s.r.l. <NA>
#> 9 L9 C301 Werner Werner AG & Co. KG… IP10
#> 10 L9 C301 Werner Werner AG & Co. KG… IP10
#> # ℹ 297 more rows
#> # ℹ abbreviated name: ¹​id_intermediate_parent_1
#> # ℹ 24 more variables: name_intermediate_parent_1 <chr>,
#> # id_ultimate_parent <chr>, name_ultimate_parent <chr>,
#> # loan_size_outstanding <dbl>, loan_size_outstanding_currency <chr>,
#> # loan_size_credit_limit <dbl>, loan_size_credit_limit_currency <chr>,
#> # sector_classification_system <chr>, sector_classification_input_type <chr>,
#> # sector_classification_direct_loantaker <dbl>, fi_type <chr>, …
#> # sector_classification_system <chr>, …
```

### 2. Prioritize validated matches
Expand All @@ -92,29 +94,26 @@ matches, prioritizing (by default) `direct_loantaker` matches over

``` r
prioritize(match_result)
#> # A tibble: 13 × 28
#> id_direct_loantaker name_direct_loantaker id_intermediate_parent_1
#> <chr> <chr> <chr>
#> 1 C26 large oil and gas company four <NA>
#> 2 C1 large automotive company five <NA>
#> 3 C35 large steel company five <NA>
#> 4 C5 large automotive company two <NA>
#> 5 C30 large power company five <NA>
#> 6 C3 large automotive company one <NA>
#> 7 C23 large hdv company three <NA>
#> 8 C33 large power company three <NA>
#> 9 C31 large power company four <NA>
#> 10 C32 large power company one <NA>
#> 11 C34 large power company two <NA>
#> 12 C25 large oil and gas company five <NA>
#> 13 C20 large coal company two <NA>
#> # ℹ 25 more variables: name_intermediate_parent_1 <chr>,
#> # A tibble: 168 × 28
#> id_loan id_direct_loantaker name_direct_loantaker id_intermediate_pare…¹
#> <chr> <chr> <chr> <chr>
#> 1 L6 C304 Kassulke-Kassulke <NA>
#> 2 L13 C297 Ladeck <NA>
#> 3 L20 C287 Weinhold <NA>
#> 4 L21 C286 Gallo Group <NA>
#> 5 L22 C285 Austermuhle GmbH <NA>
#> 6 L24 C282 Ferraro-Ferraro Group <NA>
#> 7 L25 C281 Lockman, Lockman and Lock… <NA>
#> 8 L26 C280 Ankunding, Ankunding and … <NA>
#> 9 L27 C278 Donati-Donati Group <NA>
#> 10 L28 C276 Ferraro, Ferraro e Ferrar… <NA>
#> # ℹ 158 more rows
#> # ℹ abbreviated name: ¹​id_intermediate_parent_1
#> # ℹ 24 more variables: name_intermediate_parent_1 <chr>,
#> # id_ultimate_parent <chr>, name_ultimate_parent <chr>,
#> # loan_size_outstanding <dbl>, loan_size_outstanding_currency <chr>,
#> # loan_size_credit_limit <dbl>, loan_size_credit_limit_currency <chr>,
#> # sector_classification_system <chr>, sector_classification_input_type <chr>,
#> # sector_classification_direct_loantaker <dbl>, fi_type <chr>,
#> # flag_project_finance_loan <chr>, name_project <chr>, …
#> # sector_classification_system <chr>, …
```

The result is a dataset with identical columns to the input loanbook,
Expand Down