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
93 changes: 7 additions & 86 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: "CLA Assistant"
name: CLA

on:
issue_comment:
types: [created]
Expand All @@ -10,88 +11,8 @@ permissions:
statuses: write

jobs:
CLAAssistant:
runs-on: ubuntu-24.04
steps:
- name: Generate token from GitHub App
id: app-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: blacklanternsecurity

- name: Check all committers against org and allowlist
id: cla-check
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
if [ "${{ github.event_name }}" = "pull_request_target" ]; then
PR_NUM="${{ github.event.pull_request.number }}"
else
PR_NUM="${{ github.event.issue.number }}"
fi

COMMITTERS=$(gh api "repos/${{ github.repository }}/pulls/$PR_NUM/commits" --paginate --jq '.[].author.login' | sort -u)
ALL_EXEMPT=true

for LOGIN in $COMMITTERS; do
# treat commits with no associated GitHub login as non-exempt
if [ -z "$LOGIN" ] || [ "$LOGIN" = "null" ]; then
echo "Unknown committer (no GitHub login) — not exempt"
ALL_EXEMPT=false
break
fi

EXEMPT=false

# check if account type is Bot (GitHub App accounts)
AUTHOR_TYPE=$(gh api "users/${LOGIN}" --jq '.type' 2>/dev/null || echo "Unknown")
if [ "$AUTHOR_TYPE" = "Bot" ]; then
echo "$LOGIN is a Bot account — exempt"
EXEMPT=true
fi

# check org membership
if [ "$EXEMPT" = "false" ]; then
if gh api "orgs/blacklanternsecurity/members/$LOGIN" > /dev/null 2>&1; then
echo "$LOGIN is an org member — exempt"
EXEMPT=true
fi
fi

if [ "$EXEMPT" = "false" ]; then
echo "$LOGIN is not exempt — CLA required"
ALL_EXEMPT=false
break
fi
done

echo "all_exempt=$ALL_EXEMPT" >> "$GITHUB_OUTPUT"

- name: Skip CLA when all committers are exempt
if: steps.cla-check.outputs.all_exempt == 'true' && github.event_name == 'pull_request_target'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api --method POST "repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }}" \
-f state=success \
-f context="CLAAssistant" \
-f description="CLA check skipped — all committers are org members or bots"

- name: "CLA Assistant"
if: |
(steps.cla-check.outputs.all_exempt != 'true') &&
((github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target')
uses: contributor-assistant/github-action@v2.6.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PERSONAL_ACCESS_TOKEN: ${{ steps.app-token.outputs.token }}
with:
path-to-signatures: "signatures/version1/cla.json"
path-to-document: "https://github.com/blacklanternsecurity/CLA/blob/main/ICLA.md"
branch: "main"
allowlist: "dependabot[bot],github-actions[bot],renovate[bot]"
remote-organization-name: "blacklanternsecurity"
remote-repository-name: "CLA"
lock-pullrequest-aftermerge: "false"
cla:
uses: blacklanternsecurity/CLA/.github/workflows/cla-reusable.yml@07e14bcbba5e737e1b29bd9e3f9128fbf2483be9 # CLA#11
secrets:
APP_ID: ${{ secrets.APP_ID }}
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
12 changes: 0 additions & 12 deletions .github/workflows/dependabot-auto-merge.yml

This file was deleted.

88 changes: 88 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Publish

on:
push:
branches: [stable]

permissions: {}

concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: false

jobs:
check:
permissions:
contents: read
actions: read
pull-requests: read
uses: blacklanternsecurity/CLA/.github/workflows/release-check.yml@07e14bcbba5e737e1b29bd9e3f9128fbf2483be9 # CLA#11

tests:
needs: check
if: needs.check.outputs.release == 'true'
permissions:
contents: read
uses: ./.github/workflows/tests.yml

rust-tests:
needs: check
if: needs.check.outputs.release == 'true'
permissions:
contents: read
uses: ./.github/workflows/rust-tests.yml

wheels:
needs: [tests, rust-tests]
permissions:
contents: read
uses: blacklanternsecurity/CLA/.github/workflows/maturin-wheels.yml@07e14bcbba5e737e1b29bd9e3f9128fbf2483be9 # CLA#11
with:
# scripts/build-openssl.sh builds on Linux only.
targets: '{"linux": ["x86_64", "x86", "aarch64", "armv7", "s390x", "ppc64le"], "musllinux": ["x86_64", "x86", "aarch64", "armv7"]}'
before-script-linux: scripts/wheel-container-setup.sh
env: '{"PYO3_USE_ABI3_FORWARD_COMPATIBILITY": "1"}'

crates:
needs: [check, pypi]
if: needs.check.outputs.release == 'true'
permissions:
contents: read
id-token: write
uses: blacklanternsecurity/CLA/.github/workflows/crates.yml@07e14bcbba5e737e1b29bd9e3f9128fbf2483be9 # CLA#11
with:
version: ${{ needs.check.outputs.version }}
setup-script: scripts/build-openssl.sh

pypi:
needs: wheels
runs-on: ubuntu-24.04
environment: release
permissions:
contents: read
id-token: write
attestations: write
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: ${{ needs.wheels.outputs.artifacts }}
path: dist
merge-multiple: true
- uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-path: dist/*
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
with:
skip-existing: true

release:
needs: [check, wheels, crates, pypi]
if: needs.check.outputs.release == 'true'
permissions:
contents: read
uses: blacklanternsecurity/CLA/.github/workflows/publish.yml@07e14bcbba5e737e1b29bd9e3f9128fbf2483be9 # CLA#11
with:
tag: ${{ needs.check.outputs.tag }}
version: ${{ needs.check.outputs.version }}
artifacts: ${{ needs.wheels.outputs.artifacts }}
assets: dist/*
Loading
Loading