diff --git a/.github/workflows/render-readme.yaml b/.github/workflows/render-readme.yaml index d98ee18d..aeae49ee 100644 --- a/.github/workflows/render-readme.yaml +++ b/.github/workflows/render-readme.yaml @@ -1,30 +1,38 @@ +# 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: macos-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 + - name: Checkout repo + uses: actions/checkout@v4 + 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: Install 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 + Rscript -e 'install.packages("remotes")' + Rscript -e 'remotes::install_local(".")' + + - name: Render README.Rmd file and Commit Results run: | - git config --local user.email "actions@github.com" - 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 "$GITHUB_ACTOR@users.noreply.github.com" + git commit ${README_PATH[*]/.Rmd/.md} -m 'Re-build Rmarkdown files' || echo "No changes to commit" git push origin || echo "No changes to commit" diff --git a/README.md b/README.md index 76c5373d..bbcdb83d 100644 --- a/README.md +++ b/README.md @@ -58,26 +58,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 -#> -#> 1 C26 large oil and gas company four -#> 2 C26 large oil and gas company four -#> 3 C1 large automotive company five -#> 4 C1 large automotive company five -#> 5 C35 large steel company five -#> 6 C35 large steel company five -#> 7 C5 large automotive company two -#> 8 C5 large automotive company two -#> 9 C30 large power company five -#> 10 C30 large power company five -#> # ℹ 16 more rows -#> # ℹ 25 more variables: name_intermediate_parent_1 , +#> # A tibble: 307 × 28 +#> id_loan id_direct_loantaker name_direct_loantaker id_intermediate_pare…¹ +#> +#> 1 L1 C294 Vitale Group +#> 2 L3 C292 Rowe-Rowe IP5 +#> 3 L5 C305 Ring AG & Co. KGaA +#> 4 L6 C304 Kassulke-Kassulke +#> 5 L6 C304 Kassulke-Kassulke +#> 6 L7 C227 Morissette Group +#> 7 L7 C227 Morissette Group +#> 8 L8 C303 Barone s.r.l. +#> 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 , #> # id_ultimate_parent , name_ultimate_parent , #> # loan_size_outstanding , loan_size_outstanding_currency , #> # loan_size_credit_limit , loan_size_credit_limit_currency , -#> # sector_classification_system , sector_classification_input_type , -#> # sector_classification_direct_loantaker , fi_type , … +#> # sector_classification_system , … ``` ### 2. Prioritize validated matches @@ -92,29 +92,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 -#> -#> 1 C26 large oil and gas company four -#> 2 C1 large automotive company five -#> 3 C35 large steel company five -#> 4 C5 large automotive company two -#> 5 C30 large power company five -#> 6 C3 large automotive company one -#> 7 C23 large hdv company three -#> 8 C33 large power company three -#> 9 C31 large power company four -#> 10 C32 large power company one -#> 11 C34 large power company two -#> 12 C25 large oil and gas company five -#> 13 C20 large coal company two -#> # ℹ 25 more variables: name_intermediate_parent_1 , +#> # A tibble: 168 × 28 +#> id_loan id_direct_loantaker name_direct_loantaker id_intermediate_pare…¹ +#> +#> 1 L6 C304 Kassulke-Kassulke +#> 2 L13 C297 Ladeck +#> 3 L20 C287 Weinhold +#> 4 L21 C286 Gallo Group +#> 5 L22 C285 Austermuhle GmbH +#> 6 L24 C282 Ferraro-Ferraro Group +#> 7 L25 C281 Lockman, Lockman and Lock… +#> 8 L26 C280 Ankunding, Ankunding and … +#> 9 L27 C278 Donati-Donati Group +#> 10 L28 C276 Ferraro, Ferraro e Ferrar… +#> # ℹ 158 more rows +#> # ℹ abbreviated name: ¹​id_intermediate_parent_1 +#> # ℹ 24 more variables: name_intermediate_parent_1 , #> # id_ultimate_parent , name_ultimate_parent , #> # loan_size_outstanding , loan_size_outstanding_currency , #> # loan_size_credit_limit , loan_size_credit_limit_currency , -#> # sector_classification_system , sector_classification_input_type , -#> # sector_classification_direct_loantaker , fi_type , -#> # flag_project_finance_loan , name_project , … +#> # sector_classification_system , … ``` The result is a dataset with identical columns to the input loanbook,