Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: assignees option #288

Merged
merged 1 commit into from
Feb 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@ jobs:
commit-message: "Just testing [skip ci]"
author: "J. Doe <[email protected]>"
labels: test1, test2
assignees: gr2m
- run: "git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git :test-create-new-pull-request"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@ with:
commit-message: "My commit message for uncommitted changes in lib/ folder"
author: "Lorem J. Ipsum <[email protected]>"
labels: label1, label2
assignees: user1, user2
```
To create multiple commits for different paths, use the action multiple times
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -31,6 +31,8 @@ inputs:
description: Commit selected files only by providing a path. It is used in `git add "<path>"`
labels:
description: Comma separated list of labels to apply to the pull request
assignees:
description: Comma separated list of assignees to apply to the pull request
runs:
using: "node12"
main: "dist/index.js"
17 changes: 17 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -55,6 +55,7 @@ async function main() {
commitMessage: core.getInput("commit-message"),
author: core.getInput("author"),
labels: core.getInput("labels"),
assignees: core.getInput("assignees")
};

core.debug(`Inputs: ${inspect(inputs)}`);
@@ -179,6 +180,22 @@ async function main() {
core.debug(inspect(data));
}

if (inputs.assignees) {
core.debug(`Adding assignees: ${inputs.assignees}`);
const assignees = inputs.assignees.trim().split(/\s*,\s*/);
const { data } = await request(
`POST /repos/{owner}/{repo}/issues/{issue_number}/assignees`,
{
owner,
repo,
issue_number: number,
assignees,
}
);
core.info(`Assignees added: ${assignees.join(", ")}`);
core.debug(inspect(data));
}

await runShellCommand(`git stash pop || true`);
} catch (error) {
core.info(inspect(error));