From e5d8ef695f4b499f30856ccc8ac387c99e084724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?c=C4=83t=C4=83lin?= Date: Sat, 9 Dec 2023 11:55:08 +0100 Subject: [PATCH 1/5] actions test --- .gitea/workflows/demo.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .gitea/workflows/demo.yaml diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml new file mode 100644 index 0000000..d67ac59 --- /dev/null +++ b/.gitea/workflows/demo.yaml @@ -0,0 +1,19 @@ +name: Gitea Actions Demo +run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 +on: [push] + +jobs: + Explore-Gitea-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" + - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." + - name: Check out repository code + uses: actions/checkout@v3 + - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ gitea.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." \ No newline at end of file From 9f0af185b8df6334135eb3ef968cbdad77b4e6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?c=C4=83t=C4=83lin?= Date: Sat, 9 Dec 2023 11:57:36 +0100 Subject: [PATCH 2/5] actions test --- .gitea/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index d67ac59..f886c05 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -4,7 +4,7 @@ on: [push] jobs: Explore-Gitea-Actions: - runs-on: ubuntu-latest + runs-on: fz steps: - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" From d1d2001ae93a2373950460a591b287e3824c6590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?c=C4=83t=C4=83lin?= Date: Sat, 9 Dec 2023 17:21:54 +0100 Subject: [PATCH 3/5] actions test --- .gitea/workflows/demo.yaml | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index f886c05..587faa1 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -1,19 +1,24 @@ name: Gitea Actions Demo run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 -on: [push] - +on: [ push ] jobs: - Explore-Gitea-Actions: + build-base-image: runs-on: fz steps: - - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" - - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." - - name: Check out repository code - uses: actions/checkout@v3 - - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." - - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - name: List files in the repository - run: | - ls ${{ gitea.workspace }} - - run: echo "🍏 This job's status is ${{ job.status }}." \ No newline at end of file + - uses: actions/checkout@v3 + - uses: docker/medatada-action@3 + id: medatada + with: + images: git.roboces.dev/${{ gitea.repository }} + - uses: docker/login-action@v1 + with: + registry: git.roboces.dev + username: ${{ gitea.actor }} + password: ${{ secrets.REGISTRY_PASSWORD }} + - uses: int128/kaniko-action@v1 + with: + push: true + tags: ${{ steps.metadata.outputs.tags }} + labels: ${{ steps.metadata.outputs.labels }} + cache: true + cache-repository: gitea.roboces.dev/${{ gitea.repository }}/cache \ No newline at end of file From 69972fa692dc708ab124b2804addbe5db588ab29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?c=C4=83t=C4=83lin?= Date: Sat, 9 Dec 2023 17:23:12 +0100 Subject: [PATCH 4/5] actions test --- .gitea/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 587faa1..b0e4ed5 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -2,7 +2,7 @@ name: Gitea Actions Demo run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 on: [ push ] jobs: - build-base-image: + build: runs-on: fz steps: - uses: actions/checkout@v3 From fcd96507018f305b1c306d2c0595143da37162c7 Mon Sep 17 00:00:00 2001 From: DvRodri8 Date: Wed, 13 Dec 2023 17:26:18 +0100 Subject: [PATCH 5/5] refactor: pairing algorithm --- secretsanta/domain.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/secretsanta/domain.py b/secretsanta/domain.py index 458adbc..e3d958a 100644 --- a/secretsanta/domain.py +++ b/secretsanta/domain.py @@ -15,20 +15,10 @@ class Group(BaseModel): @staticmethod def pair(names: list[str]) -> dict[str, str]: - names_copy = names[:] - random.shuffle(names_copy) - - pairings = {} - for i, name in enumerate(names): - pair = names_copy[i] - while pair == name: - random.shuffle(names_copy) - pair = names_copy[i] - - pairings[name] = pair - - return pairings - + random.shuffle(names) + names_copy = names[1:] + names_copy.append(names[0]) + return dict(zip(names, names_copy)) class IRepo(ABC): @abstractmethod