Skip to content
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
44 changes: 10 additions & 34 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,13 @@
name: ci
on: pull_request

permissions:
contents: read # enough to checkout
checks: write # allow creating check runs + annotations
pull-requests: write # (nice to have for PR-related updates)

jobs:
go-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run linters
uses: golangci/golangci-lint-action@v8
with:
version: latest
args: --timeout=3m
go-test:
strategy:
matrix:
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout code
if: success()
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: go tests
run: go test -v -covermode=count -json ./... > test.json
- name: annotate go tests
if: always()
uses: guyarb/[email protected]
with:
test-results: test.json
verify:
uses: ConductorOne/github-workflows/.github/workflows/verify.yaml@kans/go-tests
with:
ref: ${{ github.ref }}
3 changes: 1 addition & 2 deletions pkg/client/service_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ func TestIsServiceAccount(t *testing.T) {
{
name: "almost service account but different domain",
email: "[email protected]",
expected: false,
expected: true,
},
Comment on lines 44 to 47
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find the isServiceAccount function implementation
ast-grep --pattern $'func isServiceAccount($$$) $_ {
  $$$
}'

Repository: ConductorOne/baton-jira

Length of output: 249


Fix incorrect test expectation: email with .org domain should return false.

The isServiceAccount() implementation (pkg/client/client.go:37) checks: strings.HasSuffix(email, "@serviceaccount.atlassian.com"). This only accepts emails with the .com domain.

The test email [email protected] uses .org, so it will not match and isServiceAccount() returns false. The test expectation must be changed back to false, not true. The test case name "almost service account but different domain" correctly reflects this intent.

🤖 Prompt for AI Agents
In pkg/client/service_account_test.go around lines 44 to 47, the test case
"almost service account but different domain" incorrectly expects true for email
"[email protected]"; update the expected value to false so the
test aligns with isServiceAccount() which only matches
"@serviceaccount.atlassian.com". Ensure the test assertion uses the corrected
expected boolean.

}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := isServiceAccount(tt.email)
Expand Down
Loading