Skip to content
Merged
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
52 changes: 52 additions & 0 deletions .github/workflows/community.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Community

on:
pull_request_target:
types:
- opened
issues:
types:
- opened
jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Check if member of elastic org
uses: actions/github-script@v6
id: membership
with:
github-token: ${{ secrets.READ_CORTADO_ELASTIC_ORG_TOKEN }}
result-encoding: string
script: |

try {
const result = await github.rest.orgs.getMembershipForUser({
org: "elastic",
username: '${{ github.actor }}'
})

console.log(result?.data?.state)
if (result?.data?.state == "active"){
console.log("%s: detected as an active member of elastic org", '${{ github.actor }}')
return "member";
} else {
console.log("%s: not detected as active member of elastic org", '${{ github.actor }}')
return "notMember";
}

} catch (error) {
return "notMember";
}


- name: Add label for community members
uses: actions/github-script@v6
if: ${{ steps.membership.outputs.result == 'notMember' }}
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['community']
})
2 changes: 2 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Cortado
Copyright 2025 Elasticsearch B.V.
32 changes: 15 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,21 @@ $ cortado --help

Usage: cortado [OPTIONS] COMMAND [ARGS]...

╭─ Options ──────────────────────────────────────────────────────────────────────╮
│ --verbose --no-verbose [default: no-verbose] │
│ --logs-as-json --no-logs-as-json [default: no-logs-as-json] │
│ --install-completion Install completion for the │
│ current shell. │
│ --show-completion Show completion for the current │
│ shell, to copy it or customize │
│ the installation. │
│ --help Show this message and exit. │
╰────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────╮
│ generate-mapping Generate a mapping file that contains rule to RTA │
│ relations. │
│ get-coverage Calculate RTA coverage for the rules with paths that match │
│ provided glob │
│ print-rtas Print information about all available RTAs │
╰────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ─────────────────────────────────────────────────────────────────────╮
│ --verbose --no-verbose [default: no-verbose] │
│ --logs-as-json --no-logs-as-json [default: no-logs-as-json] │
│ --install-completion Install completion for the │
│ current shell. │
│ --show-completion Show completion for the │
│ current shell, to copy it or │
│ customize the installation. │
│ --help Show this message and exit. │
╰───────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ────────────────────────────────────────────────────────────────────╮
│ get-coverage Calculate RTA coverage for the rules with paths that match │
│ provided glob │
│ print-rtas Print information about all available RTAs │
╰───────────────────────────────────────────────────────────────────────────────╯
```

This script requires `utils` extra dependencies to be installed.
Expand Down