From 5ee33b6e3997e47d2443144541ff4fd43dd0b3c1 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Mon, 24 Feb 2025 14:30:29 +0100 Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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: |