Skip to content

Commit ae4643e

Browse files
authored
Merge pull request #80 from trz42/create_issue_on_pr_opened
workflow to create issue corresponding to PR
2 parents 686ac58 + 0cb5456 commit ae4643e

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Create Issue on PR Opened
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
7+
jobs:
8+
create-issue:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Create an issue
12+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
13+
with:
14+
github-token: ${{ secrets.GITHUB_TOKEN }}
15+
script: |
16+
const title = `New PR Opened: #${context.payload.pull_request.number} - ${context.payload.pull_request.title}`;
17+
const body = `
18+
A new pull request has been opened!
19+
20+
**Title:** ${context.payload.pull_request.title}
21+
**Author:** ${context.payload.pull_request.user.login}
22+
23+
**Link:** ${context.payload.pull_request.html_url}
24+
25+
Authorized maintainers may send commands to the build
26+
bots by creating new comments here. A line with a
27+
command has the format <code>bot: COMMANDS [ARGS]</code>
28+
29+
The following COMMANDS are supported:
30+
31+
- <code>help</code> _prints short usage information_
32+
- <code>show_config</code> _lets bots reply with key config information_
33+
- <code>status</code> _shows status information of builds_
34+
- <code>build [architecture|instance|repository|accelerator|exportvariable]</code> _instructs bots to build software according to the linked PR_
35+
`;
36+
37+
const issue = await github.issues.create({
38+
owner: context.repo.owner,
39+
repo: context.repo.repo,
40+
title: title,
41+
body: body,
42+
});
43+
44+
console.log(`Created issue: ${issue.data.html_url}`);

0 commit comments

Comments
 (0)