Skip to content

Commit

Permalink
use alias
Browse files Browse the repository at this point in the history
they're going with alias netlify/cli#943
  • Loading branch information
rajington committed Jun 8, 2020
1 parent 7c15289 commit a01da54
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ jobs:
- `enable-commit-comment: true` Comment on GitHub commit (default: true)
- `overwrites-pull-request-comment: true` Overwrites comment on pull request (default: true)
- `netlify-config-path: ./netlify.toml` Path to `netlify.toml` (default: undefined)
- `deploy-branch` Specifies the prefix for the deployment URL (default: Netlify build ID)
- `deploy-branch: ${{ github.head_ref }}` replicates the [branch deploy prefix](https://docs.netlify.com/site-deploys/overview/#definitions)
- `deploy-branch: deploy-preview-${{ github.event.number }}` replicates the [deploy preview prefix](https://docs.netlify.com/site-deploys/overview/#definitions)
- `alias` Specifies the prefix for the deployment URL (default: Netlify build ID)
- `alias: ${{ github.head_ref }}` replicates the [branch deploy prefix](https://docs.netlify.com/site-deploys/overview/#definitions)
- `alias: deploy-preview-${{ github.event.number }}` replicates the [deploy preview prefix](https://docs.netlify.com/site-deploys/overview/#definitions)

### Outputs
- `deploy-url` A deployment URL generated by Netlify
Expand Down
8 changes: 4 additions & 4 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ describe('defaultInputs', () => {
})
})

describe('deploy-branch', () => {
describe('alias', () => {
test('it should be a string when specified', () => {
withInput('deploy-branch', 'foo', () => {
const deployBranch: string | undefined = defaultInputs.deployBranch()
expect(deployBranch).toBe('foo')
withInput('alias', 'foo', () => {
const alias: string | undefined = defaultInputs.alias()
expect(alias).toBe('foo')
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ inputs:
netlify-config-path:
description: Path to netlify.toml
required: false
deploy-branch:
alias:
description: Specifies the prefix for the deployment URL
required: false
outputs:
Expand Down
8 changes: 4 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42477,7 +42477,7 @@ function run(inputs) {
const enableCommitComment = inputs.enableCommitComment();
const overwritesPullRequestComment = inputs.overwritesPullRequestComment();
const netlifyConfigPath = inputs.netlifyConfigPath();
const deployBranch = inputs.deployBranch();
const alias = inputs.alias();
const isDraft = productionBranch === undefined ||
github_1.context.ref !== `refs/heads/${productionBranch}`;
// Create Netlify API client
Expand All @@ -42489,7 +42489,7 @@ function run(inputs) {
draft: isDraft,
message: deployMessage,
configPath: netlifyConfigPath,
branch: deployBranch
branch: alias
});
// Create a message
const message = isDraft
Expand Down Expand Up @@ -251751,8 +251751,8 @@ exports.defaultInputs = {
netlifyConfigPath() {
return core.getInput('netlify-config-path') || undefined;
},
deployBranch() {
return core.getInput('deploy-branch') || undefined;
alias() {
return core.getInput('alias') || undefined;
}
};

Expand Down
6 changes: 3 additions & 3 deletions src/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface Inputs {
githubToken(): string
overwritesPullRequestComment(): boolean
netlifyConfigPath(): string | undefined
deployBranch(): string | undefined
alias(): string | undefined
}

export const defaultInputs: Inputs = {
Expand Down Expand Up @@ -43,7 +43,7 @@ export const defaultInputs: Inputs = {
netlifyConfigPath() {
return core.getInput('netlify-config-path') || undefined
},
deployBranch() {
return core.getInput('deploy-branch') || undefined
alias() {
return core.getInput('alias') || undefined
}
}
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async function run(inputs: Inputs): Promise<void> {
const enableCommitComment: boolean = inputs.enableCommitComment()
const overwritesPullRequestComment: boolean = inputs.overwritesPullRequestComment()
const netlifyConfigPath: string | undefined = inputs.netlifyConfigPath()
const deployBranch: string | undefined = inputs.deployBranch()
const alias: string | undefined = inputs.alias()
const isDraft: boolean =
productionBranch === undefined ||
context.ref !== `refs/heads/${productionBranch}`
Expand All @@ -84,7 +84,7 @@ async function run(inputs: Inputs): Promise<void> {
draft: isDraft,
message: deployMessage,
configPath: netlifyConfigPath,
branch: deployBranch
branch: alias
})
// Create a message
const message = isDraft
Expand Down

2 comments on commit a01da54

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.