Skip to content

Commit

Permalink
defaulted repo owner to organization in context
Browse files Browse the repository at this point in the history
  • Loading branch information
Bullrich committed Mar 31, 2023
1 parent 4d19c8e commit ca7f20c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ You can find all the inputs in [the action file](./action.yml) but let's walk th
- If using on the same repo, you can simply use `${{ github.token }}`.
- `repo`: name of the repository. Example: `https://github.com/paritytech/REPO-NAME-GOES-HERE`
- **defaults** to the repo where this action will be run.
- If set, you also need to set `owner`.
- Setting this value and `owner` allows you to run this action in other repositories (useful if you want to aggregate all the stale issues)
- If set, be sure to read the [`accessing other repositories`](#accessing-other-repositories) section.
- `owner`: name of the organization/user where the repository is. Example: `https://github.com/OWNER-NAME/stale-issues-finder`
- **defaults** to the organization where this action is ran.
- If set, you also need to set `repo`.
- `days-stale`: Amount of days since the last activity for an issue to be considered *stale*.
- **default**: 5

Expand Down
15 changes: 9 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ const generateMarkdownMessage = (issues: IssueData[], repo: { owner: string, rep
}

const getRepo = (ctx: Context): { owner: string, repo: string } => {
const repo = getInput("repo", { required: false });
const owner = getInput("owner", { required: false });
let repo = getInput("repo", { required: false });
if (!repo) {
repo = ctx.repo.repo;
}

if (repo && owner) {
return { repo, owner };
} else {
return ctx.repo;
let owner = getInput("owner", { required: false });
if (!owner) {
owner = ctx.repo.owner;
}

return { repo, owner };
}

const runAction = async (ctx: Context) => {
Expand Down

0 comments on commit ca7f20c

Please sign in to comment.