From 9388b2ecc1649d0a68d3c1ff053775ff00d4d288 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 31 Mar 2021 14:37:40 +0300 Subject: [PATCH] [ci] use GitHub Actions to re-generate R configure (#4140) * use GitHub Actions to re-generate R configure * Update R-package/README.md Co-authored-by: James Lamb Co-authored-by: James Lamb --- .github/workflows/r_configure.yml | 38 +++++++++++++++++++++++ .github/workflows/triggering_comments.yml | 8 +++++ R-package/README.md | 4 +++ 3 files changed, 50 insertions(+) create mode 100644 .github/workflows/r_configure.yml diff --git a/.github/workflows/r_configure.yml b/.github/workflows/r_configure.yml new file mode 100644 index 000000000000..812f8f5ec310 --- /dev/null +++ b/.github/workflows/r_configure.yml @@ -0,0 +1,38 @@ +name: R generate configure + +on: + repository_dispatch: + types: [gha_run_r_configure] + +jobs: + r-configure: + name: r-configure + timeout-minutes: 60 + runs-on: ubuntu-latest + container: "ubuntu:20.04" + steps: + - name: Install essential software before checkout + run: | + apt-get update + apt-get install --no-install-recommends -y \ + ca-certificates \ + git + - name: Checkout repository + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 5 + submodules: true + repository: microsoft/LightGBM + ref: "refs/heads/${{ fromJSON(github.event.client_payload.pr_branch) }}" + token: ${{ secrets.WORKFLOW }} + persist-credentials: true + - name: Update configure + shell: bash + run: ./R-package/recreate-configure.sh || exit -1 + - name: Push changes + run: | + git config --global user.name "GitHub Actions Bot" + git config --global user.email "githubactionsbot@users.noreply.github.com" + git add "./R-package/configure" + git commit --allow-empty -m "Auto-update configure" + git push diff --git a/.github/workflows/triggering_comments.yml b/.github/workflows/triggering_comments.yml index 44cad11c1539..dad50923facd 100644 --- a/.github/workflows/triggering_comments.yml +++ b/.github/workflows/triggering_comments.yml @@ -32,3 +32,11 @@ jobs: "${{ github.event.issue.pull_request.url }}" \ "${{ github.event.comment.id }}" \ "gha_run_r_solaris" + + - name: Trigger update R configure + if: github.event.comment.body == '/gha run r-configure' + run: | + $GITHUB_WORKSPACE/.ci/trigger_dispatch_run.sh \ + "${{ github.event.issue.pull_request.url }}" \ + "${{ github.event.comment.id }}" \ + "gha_run_r_configure" diff --git a/R-package/README.md b/R-package/README.md index 0d8f7d98e81a..3b4a8cb5bfbb 100644 --- a/R-package/README.md +++ b/R-package/README.md @@ -308,6 +308,10 @@ At build time, `configure` will be run and used to create a file `Makevars`, usi 3. Edit `src/Makevars.in`. +Alternatively, GitHub Actions can re-generate this file for you. On a pull request (only on internal one, does not work for ones from forks), create a comment with this phrase: + +> /gha run r-configure + **Configuring for Windows** At build time, `configure.win` will be run and used to create a file `Makevars.win`, using `Makevars.win.in` as a template.