ci: update default branch
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
name: CI
|
name: CI
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [master]
|
branches: [main]
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'README.md'
|
- 'README.md'
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [master]
|
branches: [main]
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'README.md'
|
- 'README.md'
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
@@ -29,7 +29,7 @@ jobs:
|
|||||||
path: dist
|
path: dist
|
||||||
|
|
||||||
package:
|
package:
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
needs: [build]
|
needs: [build]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -44,7 +44,7 @@ jobs:
|
|||||||
commit-message: 'build: update distribution'
|
commit-message: 'build: update distribution'
|
||||||
title: Update distribution
|
title: Update distribution
|
||||||
body: |
|
body: |
|
||||||
- Updates the distribution for changes on `master`
|
- Updates the distribution for changes on `main`
|
||||||
|
|
||||||
Auto-generated by [create-pull-request][1]
|
Auto-generated by [create-pull-request][1]
|
||||||
|
|
||||||
|
|||||||
@@ -183,13 +183,13 @@ To demonstrate, take the following configuration as an example.
|
|||||||
region=us-east-1
|
region=us-east-1
|
||||||
```
|
```
|
||||||
|
|
||||||
For the above example configuration, the slash command `/deploy branch=master dry-run reason="new feature"` will be converted to a JSON payload as follows.
|
For the above example configuration, the slash command `/deploy branch=main dry-run reason="new feature"` will be converted to a JSON payload as follows.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"slash_command": {
|
"slash_command": {
|
||||||
"command": "deploy",
|
"command": "deploy",
|
||||||
"args": {
|
"args": {
|
||||||
"all": "production region=us-east-1 branch=master dry-run reason=\"new feature\"",
|
"all": "production region=us-east-1 branch=main dry-run reason=\"new feature\"",
|
||||||
"unnamed": {
|
"unnamed": {
|
||||||
"all": "production dry-run",
|
"all": "production dry-run",
|
||||||
"arg1": "production",
|
"arg1": "production",
|
||||||
@@ -197,7 +197,7 @@ For the above example configuration, the slash command `/deploy branch=master dr
|
|||||||
},
|
},
|
||||||
"named": {
|
"named": {
|
||||||
"region": "us-east-1",
|
"region": "us-east-1",
|
||||||
"branch": "master",
|
"branch": "main",
|
||||||
"reason": "new feature"
|
"reason": "new feature"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ describe('command-helper tests', () => {
|
|||||||
test('slash command payload with named args', async () => {
|
test('slash command payload with named args', async () => {
|
||||||
const commandTokens = [
|
const commandTokens = [
|
||||||
'test',
|
'test',
|
||||||
'branch_name=master',
|
'branch_name=main',
|
||||||
'arg1',
|
'arg1',
|
||||||
'test-id=123',
|
'test-id=123',
|
||||||
'arg2'
|
'arg2'
|
||||||
@@ -279,14 +279,14 @@ describe('command-helper tests', () => {
|
|||||||
const payload: SlashCommandPayload = {
|
const payload: SlashCommandPayload = {
|
||||||
command: 'test',
|
command: 'test',
|
||||||
args: {
|
args: {
|
||||||
all: 'branch_name=master arg1 test-id=123 arg2',
|
all: 'branch_name=main arg1 test-id=123 arg2',
|
||||||
unnamed: {
|
unnamed: {
|
||||||
all: 'arg1 arg2',
|
all: 'arg1 arg2',
|
||||||
arg1: 'arg1',
|
arg1: 'arg1',
|
||||||
arg2: 'arg2'
|
arg2: 'arg2'
|
||||||
},
|
},
|
||||||
named: {
|
named: {
|
||||||
branch_name: 'master',
|
branch_name: 'main',
|
||||||
'test-id': '123'
|
'test-id': '123'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -295,12 +295,12 @@ describe('command-helper tests', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('slash command payload with named args and static args', async () => {
|
test('slash command payload with named args and static args', async () => {
|
||||||
const commandTokens = ['test', 'branch=master', 'arg1', 'dry-run']
|
const commandTokens = ['test', 'branch=main', 'arg1', 'dry-run']
|
||||||
const staticArgs = ['production', 'region=us-east-1']
|
const staticArgs = ['production', 'region=us-east-1']
|
||||||
const payload: SlashCommandPayload = {
|
const payload: SlashCommandPayload = {
|
||||||
command: 'test',
|
command: 'test',
|
||||||
args: {
|
args: {
|
||||||
all: 'production region=us-east-1 branch=master arg1 dry-run',
|
all: 'production region=us-east-1 branch=main arg1 dry-run',
|
||||||
unnamed: {
|
unnamed: {
|
||||||
all: 'production arg1 dry-run',
|
all: 'production arg1 dry-run',
|
||||||
arg1: 'production',
|
arg1: 'production',
|
||||||
@@ -309,7 +309,7 @@ describe('command-helper tests', () => {
|
|||||||
},
|
},
|
||||||
named: {
|
named: {
|
||||||
region: 'us-east-1',
|
region: 'us-east-1',
|
||||||
branch: 'master'
|
branch: 'main'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
## Use case: Execute command using a specific repository branch
|
## Use case: Execute command using a specific repository branch
|
||||||
|
|
||||||
This is a pattern for a slash command where a named argument specifies the branch to checkout. If the named argument is missing it defaults to `master`. For example, the following command will cause the command workflow to checkout the `develop` branch of the repository where the command was dispatched from. After the branch has been checked out in the command workflow, scripts, tools or actions may be executed against it.
|
This is a pattern for a slash command where a named argument specifies the branch to checkout. If the named argument is missing it defaults to `main`. For example, the following command will cause the command workflow to checkout the `develop` branch of the repository where the command was dispatched from. After the branch has been checked out in the command workflow, scripts, tools or actions may be executed against it.
|
||||||
|
|
||||||
```
|
```
|
||||||
/do-something branch=develop
|
/do-something branch=develop
|
||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
id: vars
|
id: vars
|
||||||
run: |
|
run: |
|
||||||
branch=${{ github.event.client_payload.slash_command.args.named.branch }}
|
branch=${{ github.event.client_payload.slash_command.args.named.branch }}
|
||||||
if [[ -z "$branch" ]]; then branch="master"; fi
|
if [[ -z "$branch" ]]; then branch="main"; fi
|
||||||
echo ::set-output name=branch::$branch
|
echo ::set-output name=branch::$branch
|
||||||
|
|
||||||
# Checkout the branch to test
|
# Checkout the branch to test
|
||||||
@@ -82,7 +82,7 @@ jobs:
|
|||||||
id: vars
|
id: vars
|
||||||
run: |
|
run: |
|
||||||
branch=${{ github.event.client_payload.slash_command.args.named.branch }}
|
branch=${{ github.event.client_payload.slash_command.args.named.branch }}
|
||||||
if [[ -z "$branch" ]]; then branch="master"; fi
|
if [[ -z "$branch" ]]; then branch="main"; fi
|
||||||
echo ::set-output name=branch::$branch
|
echo ::set-output name=branch::$branch
|
||||||
|
|
||||||
# Checkout the branch to test
|
# Checkout the branch to test
|
||||||
|
|||||||
+6
-6
@@ -4,26 +4,26 @@
|
|||||||
|
|
||||||
- The format of the `slash_command` context has been changed to prevent an issue where named arguments can overwrite other properties of the payload.
|
- The format of the `slash_command` context has been changed to prevent an issue where named arguments can overwrite other properties of the payload.
|
||||||
|
|
||||||
The following diff shows how the `slash_command` context has changed for the example command `/deploy branch=master smoke-test dry-run reason="new feature"`.
|
The following diff shows how the `slash_command` context has changed for the example command `/deploy branch=main smoke-test dry-run reason="new feature"`.
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
"slash_command": {
|
"slash_command": {
|
||||||
"command": "deploy",
|
"command": "deploy",
|
||||||
- "args": "branch=master smoke-test dry-run reason=\"new feature\"",
|
- "args": "branch=main smoke-test dry-run reason=\"new feature\"",
|
||||||
- "unnamed_args": "smoke-test dry-run",
|
- "unnamed_args": "smoke-test dry-run",
|
||||||
- "arg1": "smoke-test",
|
- "arg1": "smoke-test",
|
||||||
- "arg2": "dry-run"
|
- "arg2": "dry-run"
|
||||||
- "branch": "master",
|
- "branch": "main",
|
||||||
- "reason": "new feature"
|
- "reason": "new feature"
|
||||||
+ "args": {
|
+ "args": {
|
||||||
+ "all": "branch=master smoke-test dry-run reason=\"new feature\"",
|
+ "all": "branch=main smoke-test dry-run reason=\"new feature\"",
|
||||||
+ "unnamed": {
|
+ "unnamed": {
|
||||||
+ "all": "smoke-test dry-run",
|
+ "all": "smoke-test dry-run",
|
||||||
+ "arg1": "smoke-test",
|
+ "arg1": "smoke-test",
|
||||||
+ "arg2": "dry-run"
|
+ "arg2": "dry-run"
|
||||||
+ },
|
+ },
|
||||||
+ "named": {
|
+ "named": {
|
||||||
+ "branch": "master",
|
+ "branch": "main",
|
||||||
+ "reason": "new feature"
|
+ "reason": "new feature"
|
||||||
+ },
|
+ },
|
||||||
+ }
|
+ }
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
e.g.
|
e.g.
|
||||||
```
|
```
|
||||||
/deploy branch=master dry-run reason="new feature"
|
/deploy branch=main dry-run reason="new feature"
|
||||||
```
|
```
|
||||||
```
|
```
|
||||||
/send "hello world!"
|
/send "hello world!"
|
||||||
|
|||||||
Reference in New Issue
Block a user