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

GitReleaseManager repository and owner input #1388

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
9 changes: 3 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ jobs:
uses: ./gitreleasemanager/create
with:
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
repository: actions
repository: ${{ github.repository }}
milestone: "v${{ steps.gitversion.outputs.majorMinorPatch }}"
name: "v${{ steps.gitversion.outputs.majorMinorPatch }}"
isPreRelease: 'false'
Expand All @@ -67,16 +66,14 @@ jobs:
uses: ./gitreleasemanager/addasset
with:
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
repository: actions
repository: ${{ github.repository }}
milestone: "v${{ steps.gitversion.outputs.majorMinorPatch }}"
assets: ${{ steps.publish-azure.outputs.vsix }}
- name: Close Release
uses: ./gitreleasemanager/close
with:
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
repository: actions
repository: ${{ github.repository }}
milestone: "v${{ steps.gitversion.outputs.majorMinorPatch }}"
- name: Get tags
id: get-tags
Expand Down
7 changes: 3 additions & 4 deletions dist/tools/libs/gitreleasemanager.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,11 @@ class GitReleaseManagerSettingsProvider extends SettingsProvider {
}
getCommonSettings() {
const milestone = this.buildAgent.getInput("milestone");
const owner = this.buildAgent.getInput("owner");
const repository = this.buildAgent.getInput("repository");
const token = this.buildAgent.getInput("token");
const targetDirectory = this.buildAgent.getInput("targetDirectory");
const logFilePath = this.buildAgent.getInput("logFilePath");
return {
owner,
repository,
token,
targetDirectory,
Expand Down Expand Up @@ -121,8 +119,9 @@ class GitReleaseManagerTool extends DotnetTool {
}
async getCommonArguments(settings) {
const args = [];
args.push("--owner", settings.owner);
args.push("--repository", settings.repository);
const [owner, repository] = settings.repository.split("/");
args.push("--owner", owner);
args.push("--repository", repository);
args.push("--token", settings.token);
settings.targetDirectory = await this.getRepoDir(settings);
args.push("--targetDirectory", settings.targetDirectory);
Expand Down
2 changes: 1 addition & 1 deletion dist/tools/libs/gitreleasemanager.mjs.map

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions docs/examples/azure/gitreleasemanager/addasset.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
- task: gitreleasemanager/addasset@3.1.1
inputs:
token: '$(GITHUB_TOKEN)'
owner: 'someOwner'
repository: 'someRepo'
repository: 'someOwner/someRepo'
milestone: '0.1.0'
assets: |
src/test.txt
Expand Down
3 changes: 1 addition & 2 deletions docs/examples/azure/gitreleasemanager/close.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
- task: gitreleasemanager/close@3.1.1
inputs:
token: '$(GITHUB_TOKEN)'
owner: 'someOwner'
repository: 'someRepo'
repository: 'someOwner/someRepo'
milestone: '0.1.0'
```
3 changes: 1 addition & 2 deletions docs/examples/azure/gitreleasemanager/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
displayName: Create release with GitReleaseManager
inputs:
token: $(GITHUB_TOKEN)
owner: 'someOwner'
repository: 'someRepo'
repository: 'someOwner/someRepo'
milestone: '0.1.0'
name: 'v0.1.0'
assets: |
Expand Down
3 changes: 1 addition & 2 deletions docs/examples/azure/gitreleasemanager/discard.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
- task: gitreleasemanager/discard@3.1.1
inputs:
token: '$(GITHUB_TOKEN)'
owner: 'someOwner'
repository: 'someRepo'
repository: 'someOwner/someRepo'
milestone: '0.1.0'
```
3 changes: 1 addition & 2 deletions docs/examples/azure/gitreleasemanager/open.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
- task: gitreleasemanager/open@3.1.1
inputs:
token: '$(GITHUB_TOKEN)'
owner: 'someOwner'
repository: 'someRepo'
repository: 'someOwner/someRepo'
milestone: '0.1.0'
```
3 changes: 1 addition & 2 deletions docs/examples/azure/gitreleasemanager/publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
- task: gitreleasemanager/publish@3.1.1
inputs:
token: '$(GITHUB_TOKEN)'
owner: 'someOwner'
repository: 'someRepo'
repository: 'someOwner/someRepo'
milestone: '0.1.0'
```
3 changes: 1 addition & 2 deletions docs/examples/github/gitreleasemanager/addasset.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
name: Add asset to a release with GitReleaseManager
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: 'someOwner'
repository: 'someRepository'
repository: 'someOwner/someRepo'
milestone: '0.1.0'
assets: |
src/test.txt
Expand Down
3 changes: 1 addition & 2 deletions docs/examples/github/gitreleasemanager/close.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
name: Close release with GitReleaseManager
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: 'someOwner'
repository: 'someRepository'
repository: 'someOwner/someRepo'
milestone: '0.1.0'
```
3 changes: 1 addition & 2 deletions docs/examples/github/gitreleasemanager/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
name: Create release with GitReleaseManager
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: 'someOwner'
repository: 'someRepository'
repository: 'someOwner/someRepo'
milestone: '0.1.0'
name: 'v0.1.0'
assets: |
Expand Down
3 changes: 1 addition & 2 deletions docs/examples/github/gitreleasemanager/discard.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
name: Discard release with GitReleaseManager
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: 'someOwner'
repository: 'someRepository'
repository: 'someOwner/someRepo'
milestone: '0.1.0'
```
3 changes: 1 addition & 2 deletions docs/examples/github/gitreleasemanager/open.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
name: Open release with GitReleaseManager
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: 'someOwner'
repository: 'someRepository'
repository: 'someOwner/someRepo'
milestone: '0.1.0'
```
3 changes: 1 addition & 2 deletions docs/examples/github/gitreleasemanager/publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
name: Publish release with GitReleaseManager
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: 'someOwner'
repository: 'someRepository'
repository: 'someOwner/someRepo'
milestone: '0.1.0'
```
6 changes: 1 addition & 5 deletions gitreleasemanager/addasset/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ runs:
using: node20
main: main.mjs
inputs:
owner:
description: The owner of the repository
required: true
default: ''
repository:
description: The name of the repository
description: The name of the repository in the format owner/repo
required: true
default: ''
token:
Expand Down
6 changes: 1 addition & 5 deletions gitreleasemanager/close/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ runs:
using: node20
main: main.mjs
inputs:
owner:
description: The owner of the repository
required: true
default: ''
repository:
description: The name of the repository
description: The name of the repository in the format owner/repo
required: true
default: ''
token:
Expand Down
6 changes: 1 addition & 5 deletions gitreleasemanager/create/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ runs:
using: node20
main: main.mjs
inputs:
owner:
description: The owner of the repository
required: true
default: ''
repository:
description: The name of the repository
description: The name of the repository in the format owner/repo
required: true
default: ''
token:
Expand Down
6 changes: 1 addition & 5 deletions gitreleasemanager/discard/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ runs:
using: node20
main: main.mjs
inputs:
owner:
description: The owner of the repository
required: true
default: ''
repository:
description: The name of the repository
description: The name of the repository in the format owner/repo
required: true
default: ''
token:
Expand Down
6 changes: 1 addition & 5 deletions gitreleasemanager/open/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ runs:
using: node20
main: main.mjs
inputs:
owner:
description: The owner of the repository
required: true
default: ''
repository:
description: The name of the repository
description: The name of the repository in the format owner/repo
required: true
default: ''
token:
Expand Down
6 changes: 1 addition & 5 deletions gitreleasemanager/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ runs:
using: node20
main: main.mjs
inputs:
owner:
description: The owner of the repository
required: true
default: ''
repository:
description: The name of the repository
description: The name of the repository in the format owner/repo
required: true
default: ''
token:
Expand Down
18 changes: 6 additions & 12 deletions src/__tests__/tools/gitreleasemanager/settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import { expectValidSettings } from '../common/utils'
describe('GitReleaseManager settings', () => {
it('should return GitReleaseManagerCreateSettings', () => {
const settings: CreateSettings = {
repository: 'repo',
owner: 'owner',
repository: 'owner/repo',
token: 'token',
targetDirectory: 'path',
milestone: 'milestone',
Expand All @@ -42,8 +41,7 @@ describe('GitReleaseManager settings', () => {

it('should return OpenSettings', () => {
const settings: OpenSettings = {
repository: 'repo',
owner: 'owner',
repository: 'owner/repo',
token: 'token',
targetDirectory: 'path',
milestone: 'milestone',
Expand All @@ -63,8 +61,7 @@ describe('GitReleaseManager settings', () => {

it('should return GitReleaseManagerCloseSettings', () => {
const settings: CloseSettings = {
repository: 'repo',
owner: 'owner',
repository: 'owner/repo',
token: 'token',
targetDirectory: 'path',
milestone: 'milestone',
Expand All @@ -84,8 +81,7 @@ describe('GitReleaseManager settings', () => {

it('should return DiscardSettings', () => {
const settings: DiscardSettings = {
repository: 'repo',
owner: 'owner',
repository: 'owner/repo',
token: 'token',
targetDirectory: 'path',
milestone: 'milestone',
Expand All @@ -105,8 +101,7 @@ describe('GitReleaseManager settings', () => {

it('should return PublishSettings', () => {
const settings: PublishSettings = {
repository: 'repo',
owner: 'owner',
repository: 'owner/repo',
token: 'token',
targetDirectory: 'path',
milestone: 'milestone',
Expand All @@ -126,8 +121,7 @@ describe('GitReleaseManager settings', () => {

it('should return AddAssetSettings', () => {
const settings: AddAssetSettings = {
repository: 'repo',
owner: 'owner',
repository: 'owner/repo',
token: 'token',
targetDirectory: 'path',
milestone: 'milestone',
Expand Down
3 changes: 1 addition & 2 deletions src/__tests__/tools/gitreleasemanager/tool.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ describe('GitReleaseManagerTool', () => {

describe('getArguments', () => {
const commonSettings = {
owner: 'owner',
repository: 'repo',
repository: 'owner/repo',
token: 'token',
targetDirectory: 'targetDirectory',
logFilePath: './logFilePath'
Expand Down
1 change: 0 additions & 1 deletion src/tools/gitreleasemanager/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export type Commands = 'setup' | 'addasset' | 'close' | 'create' | 'discard' | '

export type CommonSettings = {
repository: string
owner: string
token: string
targetDirectory: string
milestone: string
Expand Down
2 changes: 0 additions & 2 deletions src/tools/gitreleasemanager/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,12 @@ export class GitReleaseManagerSettingsProvider extends SettingsProvider implemen

getCommonSettings(): CommonSettings {
const milestone = this.buildAgent.getInput<CommonSettings>('milestone')
const owner = this.buildAgent.getInput<CommonSettings>('owner')
const repository = this.buildAgent.getInput<CommonSettings>('repository')
const token = this.buildAgent.getInput<CommonSettings>('token')
const targetDirectory = this.buildAgent.getInput<CommonSettings>('targetDirectory')
const logFilePath = this.buildAgent.getInput<CommonSettings>('logFilePath')

return {
owner,
repository,
token,
targetDirectory,
Expand Down
5 changes: 3 additions & 2 deletions src/tools/gitreleasemanager/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ export class GitReleaseManagerTool extends DotnetTool {
protected async getCommonArguments(settings: CommonSettings): Promise<string[]> {
const args: string[] = []

args.push('--owner', settings.owner)
args.push('--repository', settings.repository)
const [owner, repository] = settings.repository.split('/') // this is the github repository
args.push('--owner', owner)
args.push('--repository', repository)
args.push('--token', settings.token)

settings.targetDirectory = await this.getRepoDir(settings)
Expand Down
Loading