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..a8125be147 --- /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@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + 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}`);