forked from EESSI/software-layer
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
proof of concept for GitHub action that opens an issue for a PR
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
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 to PR:** ${context.payload.pull_request.html_url} | ||
<details><summary>Click for details & help</summary> | ||
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 <code>bot: COMMANDS [ARGS]</code> | ||
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 ARGS | instructs to build software as defined by the linked PR and with the one or more of the arguments:<br/>architecture, instance, repository, accelerator, exportvariable | | ||
For more information see [building software for EESSI](https://www.eessi.io/docs/bot/#build-test-deploy-bot) | ||
</details> | ||
`; | ||
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}`); |