Skip to content

Commit 6bde33d

Browse files
committed
chore: merge w main
2 parents 96f638b + 758884c commit 6bde33d

File tree

28 files changed

+68
-52
lines changed

28 files changed

+68
-52
lines changed

.github/workflows/delete-pr-build-on-close.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
name: Delete pre-release when a branch is deleted
2-
# Runs when PRs are merged or closed.
2+
# This workflow action deletes pre-releases when a PR is merged or closed.
3+
#
4+
# The CircleCI configuration builds CLI binaries when a PR is opened.
5+
# These are uploaded to the upstream project as GitHub (pre-)releases.
6+
#
7+
# The release tag matches one of the following patterns:
8+
# - v1.2.3-example-branch-placeholder # Branches on upstream
9+
# - v1.2.3-pull-12-head # Branches from forks
10+
#
11+
# A "pull_request_target" event is used to delete pre-releases upstream.
12+
#
313
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-pull_request-workflow-when-a-pull-request-merges
4-
# The circleci config builds CLI binaries when a PR is opened and hosts them under a GitHub (pre-)release named after the PR branch
5-
# This workflow action deletes that pre-release when a PR is merged or closed.
14+
# See https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request_target
615
on:
7-
delete:
8-
branches:
16+
pull_request_target:
17+
types:
18+
- closed
919

1020
jobs:
1121
delete-pre-release:
@@ -17,8 +27,15 @@ jobs:
1727
GH_TOKEN: ${{ github.token }}
1828
shell: bash
1929
run: |
30+
# Use either an upstream or fork PR branch
31+
if [[ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then
32+
BRANCH="pull/${{ github.event.pull_request.number }}/head"
33+
else
34+
BRANCH="${{ github.event.pull_request.head.ref }}"
35+
fi
36+
2037
# Escape tags to create a semantic version
21-
REF=$(echo "${{ github.event.ref }}" | sed 's/\//-/g')
38+
REF=$(echo "${BRANCH}" | sed 's/\//-/g')
2239
RELEASE_FOUND=1
2340
2441
# Delete tags matching the pull request branch from forks

ci/circleci/runner/src/circlerunner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def security_validation(self, file_path):
116116
"""validate file security for runner execution, besides file existence,
117117
the file needs to pass the following validation:
118118
1. it needs to be owned by root
119-
2. it needs to be only readable (and optionaly executable)
119+
2. it needs to be only readable (and optionally executable)
120120
by owner(root) (mode 500 or 400)
121121
"""
122122
self.logger.debug(f"validating script file {file_path}")

ci/circleci/runner/src/macrunner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def do_the_job(self, job_name, job_params):
9090
for local_path in files:
9191
self.upload_file_to_s3(source_file_path=local_path, s3_path=s3_path)
9292
else:
93-
raise Exception(f"unknow job to execute {job_name}")
93+
raise Exception(f"unknown job to execute {job_name}")
9494

9595
if __name__ == "__main__":
9696
parser = optparse.OptionParser()

cmd/auth/login_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var mockOrgAuth = types.SlackAuth{
4040
}
4141
var mockOrgAuthURL = "https://url.com"
4242

43-
func TestLoginCommmand(t *testing.T) {
43+
func TestLoginCommand(t *testing.T) {
4444
testutil.TableTestCommand(t, testutil.CommandTests{
4545
"errors when the challenge flag is provided without the ticket flag": {
4646
CmdArgs: []string{"--challenge=achallengestring"},

cmd/datastore/query_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ func TestQueryCommand(t *testing.T) {
278278
Option: "status",
279279
Index: 0,
280280
}, nil)
281-
clientsMock.IO.On("SelectPrompt", mock.Anything, "Slect an attribute for '#task_id'", mock.Anything, iostreams.MatchPromptConfig(iostreams.SelectPromptConfig{
281+
clientsMock.IO.On("SelectPrompt", mock.Anything, "Select an attribute for '#task_id'", mock.Anything, iostreams.MatchPromptConfig(iostreams.SelectPromptConfig{
282282
Flag: clientsMock.Config.Flags.Lookup("attributes"),
283283
})).Return(iostreams.SelectPromptResponse{
284284
Prompt: true,

cmd/manifest/validate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func newValidateLogger(clients *shared.ClientFactory, cmd *cobra.Command) *logge
124124
)
125125
}
126126

127-
// gatherAuthenticationToken returns some user token and configures authenication
127+
// gatherAuthenticationToken returns some user token and configures authentication
128128
// internals for API use
129129
func gatherAuthenticationToken(ctx context.Context, clients *shared.ClientFactory) (auth types.SlackAuth, err error) {
130130
defer func() {

cmd/project/create_samples.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func filterRepos(sampleRepos []create.GithubRepo, projectType string) []create.G
7474
return filteredRepos
7575
}
7676

77-
// sortRepos sorts the provided repostiories by the
77+
// sortRepos sorts the provided repositories by the
7878
// StargazersCount field in descending order
7979
func sortRepos(sampleRepos []create.GithubRepo) []create.GithubRepo {
8080
sortedRepos := sampleRepos

cmd/triggers/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func runCreateCommand(clients *shared.ClientFactory, cmd *cobra.Command) error {
116116
app = _app
117117
}
118118

119-
err = validateCreateCmdFlags(clients, &createFlags)
119+
err = validateCreateCmdFlags(ctx, clients, &createFlags)
120120
if err != nil {
121121
return err
122122
}

cmd/triggers/create_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,8 @@ func TestTriggersCreateCommand_promptShouldDisplayTriggerDefinitionFiles(t *test
653653

654654
for _, testcase := range testcases {
655655
t.Run(testcase.name, func(t *testing.T) {
656-
657656
// Prepare mocks
657+
ctx := slackcontext.MockContext(t.Context())
658658
clientsMock := shared.NewClientsMock()
659659
testcase.prepareMocks(clientsMock)
660660
clients := shared.NewClientFactory(clientsMock.MockClientFactory())
@@ -663,7 +663,7 @@ func TestTriggersCreateCommand_promptShouldDisplayTriggerDefinitionFiles(t *test
663663

664664
var err error
665665
createFlags := createCmdFlags{}
666-
err = maybeSetTriggerDefFlag(clients, &createFlags)
666+
err = maybeSetTriggerDefFlag(ctx, clients, &createFlags)
667667
testcase.check(t, createFlags, err)
668668
})
669669
}

cmd/triggers/generate.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func TriggerGenerate(ctx context.Context, clients *shared.ClientFactory, app typ
7878
},
7979
})))
8080

81-
triggerFilePaths, err := getFullyQualifiedTriggerFilePaths(clients, triggerPaths)
81+
triggerFilePaths, err := getFullyQualifiedTriggerFilePaths(ctx, clients, triggerPaths)
8282
if err != nil {
8383
return nil, err
8484
}
@@ -171,8 +171,7 @@ func getTriggerPaths(sdkCLIConfig *hooks.SDKCLIConfig) []string {
171171

172172
// getFullyQualifiedTriggerFilePaths returns an array of file paths that
173173
// are validated
174-
func getFullyQualifiedTriggerFilePaths(clients *shared.ClientFactory, triggerPaths []string) ([]string, error) {
175-
ctx := context.Background()
174+
func getFullyQualifiedTriggerFilePaths(ctx context.Context, clients *shared.ClientFactory, triggerPaths []string) ([]string, error) {
176175
projectDir, err := clients.Os.Getwd()
177176
if err != nil {
178177
return nil, err
@@ -239,7 +238,7 @@ func isValidTriggerFilePath(triggerPath string) bool {
239238
return true
240239
}
241240

242-
func validateCreateCmdFlags(clients *shared.ClientFactory, createFlags *createCmdFlags) error {
241+
func validateCreateCmdFlags(ctx context.Context, clients *shared.ClientFactory, createFlags *createCmdFlags) error {
243242
if createFlags.triggerDef != "" {
244243
exists, err := afero.Exists(clients.Fs, createFlags.triggerDef)
245244
if err != nil {
@@ -280,7 +279,7 @@ func validateCreateCmdFlags(clients *shared.ClientFactory, createFlags *createCm
280279
}
281280

282281
if createFlags.triggerDef == "" && createFlags.workflow == "" {
283-
return maybeSetTriggerDefFlag(clients, createFlags)
282+
return maybeSetTriggerDefFlag(ctx, clients, createFlags)
284283
}
285284

286285
if createFlags.description == "" {
@@ -290,16 +289,15 @@ func validateCreateCmdFlags(clients *shared.ClientFactory, createFlags *createCm
290289
return nil
291290
}
292291

293-
func maybeSetTriggerDefFlag(clients *shared.ClientFactory, createFlags *createCmdFlags) error {
294-
ctx := context.Background()
292+
func maybeSetTriggerDefFlag(ctx context.Context, clients *shared.ClientFactory, createFlags *createCmdFlags) error {
295293
triggerPaths := getTriggerPaths(&clients.SDKConfig)
296294

297295
fmt.Printf("%s", style.Sectionf(style.TextSection{
298296
Emoji: "zap",
299297
Text: fmt.Sprintf("Searching for trigger definition files under '%s'...", strings.Join(triggerPaths, ", ")),
300298
}))
301299

302-
triggerFilePaths, err := getFullyQualifiedTriggerFilePaths(clients, triggerPaths)
300+
triggerFilePaths, err := getFullyQualifiedTriggerFilePaths(ctx, clients, triggerPaths)
303301
if err != nil {
304302
return err
305303
}

0 commit comments

Comments
 (0)