From 5ee33b6e3997e47d2443144541ff4fd43dd0b3c1 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Mon, 24 Feb 2025 14:30:29 +0100 Subject: [PATCH 01/13] workflow to create issue corresponding to PR --- .../workflows/create-issue-on-pr-opened.yml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/create-issue-on-pr-opened.yml diff --git a/.github/workflows/create-issue-on-pr-opened.yml b/.github/workflows/create-issue-on-pr-opened.yml new file mode 100644 index 0000000000..1322c78462 --- /dev/null +++ b/.github/workflows/create-issue-on-pr-opened.yml @@ -0,0 +1,44 @@ +name: Create Issue on PR Opened + +on: + pull_request: + types: [opened] + +jobs: + create-issue: + runs-on: ubuntu-latest + steps: + - name: Create an issue + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const title = `New PR Opened: #${context.payload.pull_request.number} - ${context.payload.pull_request.title}`; + const body = ` + A new pull request has been opened! + + **Title:** ${context.payload.pull_request.title} + **Author:** ${context.payload.pull_request.user.login} + + **Link:** ${context.payload.pull_request.html_url} + + Authorized maintainers may send commands to the build + bots by creating new comments here. A line with a + command has the format bot: COMMANDS [ARGS] + + The following COMMANDS are supported: + + - `help` _prints short usage information_ + - `show_config` _lets bots reply with key config information_ + - `status` _shows status information of builds_ + - `build [architecture|instance|repository|accelerator|exportvariable]` _instructs bots to build software according to the linked PR_ + `; + + const issue = await github.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: title, + body: body, + }); + + console.log(`Created issue: ${issue.data.html_url}`); From f70f5ad537a57c645e64e16e0b4e1c3060a33b2d Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Mon, 24 Feb 2025 14:34:10 +0100 Subject: [PATCH 02/13] use code instead of backticks --- .github/workflows/create-issue-on-pr-opened.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create-issue-on-pr-opened.yml b/.github/workflows/create-issue-on-pr-opened.yml index 1322c78462..a9f3b7ef9c 100644 --- a/.github/workflows/create-issue-on-pr-opened.yml +++ b/.github/workflows/create-issue-on-pr-opened.yml @@ -28,10 +28,10 @@ jobs: The following COMMANDS are supported: - - `help` _prints short usage information_ - - `show_config` _lets bots reply with key config information_ - - `status` _shows status information of builds_ - - `build [architecture|instance|repository|accelerator|exportvariable]` _instructs bots to build software according to the linked PR_ + - help _prints short usage information_ + - show_config _lets bots reply with key config information_ + - status _shows status information of builds_ + - build [architecture|instance|repository|accelerator|exportvariable] _instructs bots to build software according to the linked PR_ `; const issue = await github.issues.create({ From 0cb54568842690f723330af63a204da427886f62 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Mon, 24 Feb 2025 14:43:31 +0100 Subject: [PATCH 03/13] use specific version of action --- .github/workflows/create-issue-on-pr-opened.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-issue-on-pr-opened.yml b/.github/workflows/create-issue-on-pr-opened.yml index a9f3b7ef9c..a8125be147 100644 --- a/.github/workflows/create-issue-on-pr-opened.yml +++ b/.github/workflows/create-issue-on-pr-opened.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Create an issue - uses: actions/github-script@v6 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | From dfaefbdffaf6d2e9f628b99fa0c552bbbdcf076e Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Mon, 24 Feb 2025 14:46:54 +0100 Subject: [PATCH 04/13] testing issue creation --- foo | 1 + 1 file changed, 1 insertion(+) create mode 100644 foo diff --git a/foo b/foo new file mode 100644 index 0000000000..5716ca5987 --- /dev/null +++ b/foo @@ -0,0 +1 @@ +bar From 5ac6f19a1bab93a7c09ce4887bbd35e20105f66b Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Mon, 24 Feb 2025 14:59:26 +0100 Subject: [PATCH 05/13] run wf for push and fix script error --- .github/workflows/create-issue-on-pr-opened.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-issue-on-pr-opened.yml b/.github/workflows/create-issue-on-pr-opened.yml index a8125be147..05751426b8 100644 --- a/.github/workflows/create-issue-on-pr-opened.yml +++ b/.github/workflows/create-issue-on-pr-opened.yml @@ -2,7 +2,7 @@ name: Create Issue on PR Opened on: pull_request: - types: [opened] + types: [opened, synchronize] jobs: create-issue: @@ -34,7 +34,7 @@ jobs: - build [architecture|instance|repository|accelerator|exportvariable] _instructs bots to build software according to the linked PR_ `; - const issue = await github.issues.create({ + const issue = await github.rest.issues.create({ owner: context.repo.owner, repo: context.repo.repo, title: title, From b61aa67e723b121021d7f4e0b836fd8b830e73ae Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Mon, 24 Feb 2025 15:06:09 +0100 Subject: [PATCH 06/13] try better formatting of title and body --- .../workflows/create-issue-on-pr-opened.yml | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/create-issue-on-pr-opened.yml b/.github/workflows/create-issue-on-pr-opened.yml index 05751426b8..4722fdd2e8 100644 --- a/.github/workflows/create-issue-on-pr-opened.yml +++ b/.github/workflows/create-issue-on-pr-opened.yml @@ -13,32 +13,32 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - const title = `New PR Opened: #${context.payload.pull_request.number} - ${context.payload.pull_request.title}`; + const title = 'New PR Opened: #' + context.payload.pull_request.number + ' - ' + context.payload.pull_request.title; const body = ` - A new pull request has been opened! +A new pull request #${context.payload.pull_request.number} has been opened! - **Title:** ${context.payload.pull_request.title} - **Author:** ${context.payload.pull_request.user.login} +**Title:** ${context.payload.pull_request.title} +**Author:** ${context.payload.pull_request.user.login} - **Link:** ${context.payload.pull_request.html_url} +**Link:** ${context.payload.pull_request.html_url} - Authorized maintainers may send commands to the build - bots by creating new comments here. A line with a - command has the format bot: COMMANDS [ARGS] +Authorized maintainers may send commands to the build +bots by creating new comments here. A line with a +command has the format bot: COMMANDS [ARGS] - The following COMMANDS are supported: +The following COMMANDS are supported: - - help _prints short usage information_ - - show_config _lets bots reply with key config information_ - - status _shows status information of builds_ - - build [architecture|instance|repository|accelerator|exportvariable] _instructs bots to build software according to the linked PR_ +- help _prints short usage information_ +- show_config _lets bots reply with key config information_ +- status _shows status information of builds_ +- build [architecture|instance|repository|accelerator|exportvariable] _instructs bots to build software according to the linked PR_ `; - + const issue = await github.rest.issues.create({ owner: context.repo.owner, repo: context.repo.repo, title: title, body: body, }); - + console.log(`Created issue: ${issue.data.html_url}`); From 1cc81ec6b15bfee3f70973cd8e765414fb5a750f Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Mon, 24 Feb 2025 15:09:35 +0100 Subject: [PATCH 07/13] fix error in body --- .github/workflows/create-issue-on-pr-opened.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-issue-on-pr-opened.yml b/.github/workflows/create-issue-on-pr-opened.yml index 4722fdd2e8..81e17e64e1 100644 --- a/.github/workflows/create-issue-on-pr-opened.yml +++ b/.github/workflows/create-issue-on-pr-opened.yml @@ -15,7 +15,7 @@ jobs: script: | const title = 'New PR Opened: #' + context.payload.pull_request.number + ' - ' + context.payload.pull_request.title; const body = ` -A new pull request #${context.payload.pull_request.number} has been opened! +A new pull request has been opened! **Title:** ${context.payload.pull_request.title} **Author:** ${context.payload.pull_request.user.login} From 62ee47a45462aa4351e7ab9f5ee909bf08fc3ddf Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Mon, 24 Feb 2025 15:28:21 +0100 Subject: [PATCH 08/13] try to fix yaml syntax --- .../workflows/create-issue-on-pr-opened.yml | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/create-issue-on-pr-opened.yml b/.github/workflows/create-issue-on-pr-opened.yml index 81e17e64e1..f3b7ec1ca5 100644 --- a/.github/workflows/create-issue-on-pr-opened.yml +++ b/.github/workflows/create-issue-on-pr-opened.yml @@ -15,24 +15,24 @@ jobs: script: | const title = 'New PR Opened: #' + context.payload.pull_request.number + ' - ' + context.payload.pull_request.title; const body = ` -A new pull request has been opened! + A new pull request has been opened! -**Title:** ${context.payload.pull_request.title} -**Author:** ${context.payload.pull_request.user.login} + **Title:** ${context.payload.pull_request.title} + **Author:** ${context.payload.pull_request.user.login} -**Link:** ${context.payload.pull_request.html_url} + **Link:** ${context.payload.pull_request.html_url} -Authorized maintainers may send commands to the build -bots by creating new comments here. A line with a -command has the format bot: COMMANDS [ARGS] + Authorized maintainers may send commands to the build + bots by creating new comments here. A line with a + command has the format bot: COMMANDS [ARGS] -The following COMMANDS are supported: + The following COMMANDS are supported: -- help _prints short usage information_ -- show_config _lets bots reply with key config information_ -- status _shows status information of builds_ -- build [architecture|instance|repository|accelerator|exportvariable] _instructs bots to build software according to the linked PR_ - `; + - help _prints short usage information_ + - show_config _lets bots reply with key config information_ + - status _shows status information of builds_ + - build [architecture|instance|repository|accelerator|exportvariable] _instructs bots to build software according to the linked PR_ + `; const issue = await github.rest.issues.create({ owner: context.repo.owner, From 3f941772f87fb6b8c06807f76484e6ef569d27ec Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Mon, 24 Feb 2025 15:42:23 +0100 Subject: [PATCH 09/13] polish formatting --- .github/workflows/create-issue-on-pr-opened.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/create-issue-on-pr-opened.yml b/.github/workflows/create-issue-on-pr-opened.yml index f3b7ec1ca5..01d8e15bae 100644 --- a/.github/workflows/create-issue-on-pr-opened.yml +++ b/.github/workflows/create-issue-on-pr-opened.yml @@ -13,25 +13,24 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - const title = 'New PR Opened: #' + context.payload.pull_request.number + ' - ' + context.payload.pull_request.title; + const title = `New PR opened: #${context.payload.pull_request.number} - ${context.payload.pull_request.title}`; const body = ` A new pull request has been opened! **Title:** ${context.payload.pull_request.title} **Author:** ${context.payload.pull_request.user.login} - **Link:** ${context.payload.pull_request.html_url} + **Link to PR:** ${context.payload.pull_request.html_url} - Authorized maintainers may send commands to the build - bots by creating new comments here. A line with a - command has the format bot: COMMANDS [ARGS] +
Click for details & help + Authorized maintainers may send commands to the build bots by creating new comments here. A line with a command has the format bot: COMMANDS [ARGS] The following COMMANDS are supported: - - help _prints short usage information_ - - show_config _lets bots reply with key config information_ + - show_config _shows config information_ - status _shows status information of builds_ - build [architecture|instance|repository|accelerator|exportvariable] _instructs bots to build software according to the linked PR_ +
`; const issue = await github.rest.issues.create({ From fbdd930ff272ec41838154a49b4a422e2f58cc74 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Mon, 24 Feb 2025 15:49:37 +0100 Subject: [PATCH 10/13] more polishing --- .github/workflows/create-issue-on-pr-opened.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-issue-on-pr-opened.yml b/.github/workflows/create-issue-on-pr-opened.yml index 01d8e15bae..c792babdd3 100644 --- a/.github/workflows/create-issue-on-pr-opened.yml +++ b/.github/workflows/create-issue-on-pr-opened.yml @@ -23,13 +23,14 @@ jobs: **Link to PR:** ${context.payload.pull_request.html_url}
Click for details & help - Authorized maintainers may send commands to the build bots by creating new comments here. A line with a command has the format bot: COMMANDS [ARGS] + + Authorized maintainers may send commands to the build bots by creating new comments in this issue. A comment can contain multiple commands each starting at the beginning of a line and having the format bot: COMMANDS [ARGS] The following COMMANDS are supported: - help _prints short usage information_ - show_config _shows config information_ - status _shows status information of builds_ - - build [architecture|instance|repository|accelerator|exportvariable] _instructs bots to build software according to the linked PR_ + - build [architecture|instance|repository|accelerator|exportvariable] _instructs to build software according to the linked PR_
`; From 2bd87fa0c056a189382539de17e4e8a0f08cd208 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Mon, 24 Feb 2025 15:57:27 +0100 Subject: [PATCH 11/13] reformatting commands as a table --- .github/workflows/create-issue-on-pr-opened.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create-issue-on-pr-opened.yml b/.github/workflows/create-issue-on-pr-opened.yml index c792babdd3..2bdcad371c 100644 --- a/.github/workflows/create-issue-on-pr-opened.yml +++ b/.github/workflows/create-issue-on-pr-opened.yml @@ -24,13 +24,15 @@ jobs:
Click for details & help - Authorized maintainers may send commands to the build bots by creating new comments in this issue. A comment can contain multiple commands each starting at the beginning of a line and having the format bot: COMMANDS [ARGS] + Authorized maintainers may send commands by adding new comments to this issue. A comment can contain multiple commands each starting at the beginning of a line and having the format bot: COMMANDS [ARGS] The following COMMANDS are supported: - - help _prints short usage information_ - - show_config _shows config information_ - - status _shows status information of builds_ - - build [architecture|instance|repository|accelerator|exportvariable] _instructs to build software according to the linked PR_ + | command | description | + | ------- | ----------- | + | help | prints short usage information | + | show_config | shows config information | + | status | shows status information of builds | + | build [architecture|instance|repository|accelerator|exportvariable] | instructs to build software according to the linked PR |
`; From 38a2eda324aee44e50eeee2cf154082300bbe72d Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Mon, 24 Feb 2025 16:03:30 +0100 Subject: [PATCH 12/13] escape pipe symbol --- .github/workflows/create-issue-on-pr-opened.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create-issue-on-pr-opened.yml b/.github/workflows/create-issue-on-pr-opened.yml index 2bdcad371c..5947dc05b1 100644 --- a/.github/workflows/create-issue-on-pr-opened.yml +++ b/.github/workflows/create-issue-on-pr-opened.yml @@ -26,13 +26,13 @@ jobs: Authorized maintainers may send commands by adding new comments to this issue. A comment can contain multiple commands each starting at the beginning of a line and having the format bot: COMMANDS [ARGS] - The following COMMANDS are supported: + The table below lists the commands that are currently supported: | command | description | | ------- | ----------- | - | help | prints short usage information | - | show_config | shows config information | - | status | shows status information of builds | - | build [architecture|instance|repository|accelerator|exportvariable] | instructs to build software according to the linked PR | + | help | prints short usage information | + | show_config | shows config information | + | status | shows status information of builds | + | build [architecture\|instance\|repository\|accelerator\|exportvariable] | instructs to build software according to the linked PR | `; From c4eb21526de6930f2a15d322b4a5f6697ab4b957 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Mon, 24 Feb 2025 16:13:05 +0100 Subject: [PATCH 13/13] reformat build command description and add link to docs --- .github/workflows/create-issue-on-pr-opened.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-issue-on-pr-opened.yml b/.github/workflows/create-issue-on-pr-opened.yml index 5947dc05b1..0bd1d2dde9 100644 --- a/.github/workflows/create-issue-on-pr-opened.yml +++ b/.github/workflows/create-issue-on-pr-opened.yml @@ -32,7 +32,9 @@ jobs: | help | prints short usage information | | show_config | shows config information | | status | shows status information of builds | - | build [architecture\|instance\|repository\|accelerator\|exportvariable] | instructs to build software according to the linked PR | + | build ARGS | instructs to build software as defined by the linked PR and with the one or more of the arguments:
architecture, instance, repository, accelerator, exportvariable | + + For more information see [building software for EESSI](https://www.eessi.io/docs/bot/#build-test-deploy-bot) `;