Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Fix duplicate Docker builds on release and CLA workflow ghost runs

Murtaza Nasir6abc3b7437c3
diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml
index 29bf7295..736690b6 100644
--- a/.github/workflows/cla.yml
+++ b/.github/workflows/cla.yml
@@ -4,31 +4,36 @@ on:
types: [opened]
permissions:
- issues: write
pull-requests: write
jobs:
cla-reminder:
+ if: github.event_name == 'pull_request_target'
runs-on: ubuntu-latest
steps:
- name: "Post CLA Reminder"
uses: actions/github-script@v7
with:
script: |
+ const prNumber = context.payload.pull_request?.number;
+ if (!prNumber) {
+ console.log('No PR number found, skipping');
+ return;
+ }
const body = `Thank you for your contribution!
-By submitting this pull request, you agree to the terms of our [Contributor License Agreement (CLA)](https://github.com/${context.repo.owner}/${context.repo.repo}/blob/master/CLA.md).
+ By submitting this pull request, you agree to the terms of our [Contributor License Agreement (CLA)](https://github.com/${context.repo.owner}/${context.repo.repo}/blob/master/CLA.md).
-**Key points:**
-- You retain copyright ownership of your contribution
-- You grant us permission to use your contribution under our dual-license model (AGPLv3 and Commercial)
-- This allows us to include your contribution in both the open source and commercial versions of Speakr
+ **Key points:**
+ - You retain copyright ownership of your contribution
+ - You grant us permission to use your contribution under our dual-license model (AGPLv3 and Commercial)
+ - This allows us to include your contribution in both the open source and commercial versions of Speakr
-If you have any questions about the CLA, please let us know!`;
+ If you have any questions about the CLA, please let us know!`.replace(/^ {12}/gm, '');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
- issue_number: context.payload.pull_request.number,
+ issue_number: prNumber,
body: body
});
diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml
index 83edb205..05fd29b0 100644
--- a/.github/workflows/docker-publish.yml
+++ b/.github/workflows/docker-publish.yml
@@ -3,8 +3,6 @@ name: Docker Build and Publish
on:
release:
types: [published]
- push:
- tags: [ 'v*.*.*' ]
workflow_dispatch:
env:
@@ -97,12 +95,9 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
- type=ref,event=branch
- type=ref,event=pr
- type=semver,pattern={{version}}
- type=semver,pattern={{major}}.{{minor}}
+ type=match,pattern=v(.*),group=1
type=sha
- type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' || github.event_name == 'release' || startsWith(github.ref, 'refs/tags/v') }}
+ type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' || github.event_name == 'release' }}
# Build and push full Docker image
- name: Build and push Docker image
@@ -162,9 +157,8 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
- type=raw,value=lite,enable=${{ github.event_name == 'workflow_dispatch' || github.event_name == 'release' || startsWith(github.ref, 'refs/tags/v') }}
- type=semver,pattern={{version}}-lite
- type=semver,pattern={{major}}.{{minor}}-lite
+ type=raw,value=lite,enable=${{ github.event_name == 'workflow_dispatch' || github.event_name == 'release' }}
+ type=match,pattern=v(.*),group=1,suffix=-lite
type=sha,suffix=-lite
# Build and push lightweight Docker image (no PyTorch/sentence-transformers)