Skip to content

Commit

Permalink
fix(): correct usage of paths-filter action
Browse files Browse the repository at this point in the history
  • Loading branch information
Skraye committed Feb 5, 2025
1 parent b678f2a commit 40b9c78
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 20 deletions.
39 changes: 23 additions & 16 deletions .github/actions/action-backend-test/action.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
name: 'Basic Multi-Step Action'
description: 'A basic GitHub Action that runs multiple steps.'
name: 'Backend Test'

inputs:
example-input:
description: 'An example input'
google-service-account:
description: 'Google Service Account'
required: true
sonar-token:
description: 'Sonar Token'
required: false
github-token:
description: 'GitHub Token'
required: true
codecov-token:
description: 'Codecov Token'
required: false
default: 'default value'

runs:
using: composite
Expand All @@ -29,7 +36,7 @@ runs:
- name: Build with Gradle
if: ${{ github.event.inputs.skip-test == 'false' || github.event.inputs.skip-test == '' }}
env:
GOOGLE_SERVICE_ACCOUNT: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
GOOGLE_SERVICE_ACCOUNT: ${{ inputs.google-service-account }}
shell: bash
run: |
echo $GOOGLE_SERVICE_ACCOUNT | base64 -d > ~/.gcp-service-account.json
Expand All @@ -38,28 +45,28 @@ runs:
# Sonar
- name: Analyze with Sonar
if: ${{ env.SONAR_TOKEN != 0 }}
if: ${{ inputs.sonar-token != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ inputs.github-token }}
SONAR_TOKEN: ${{ inputs.sonar-token }}
shell: bash
run: ./gradlew sonar --info

# Allure check
- name: Auth to Google Cloud
id: auth
if: ${{ always() && env.GOOGLE_SERVICE_ACCOUNT != 0 }}
if: ${{ always() && inputs.google-service-account != '' }}
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.GOOGLE_SERVICE_ACCOUNT }}"
credentials_json: "${{ inputs.google-service-account }}"

- uses: rlespinasse/github-slug-action@v5

- name: Publish allure report
uses: andrcuns/[email protected]
if: ${{ always() && env.GOOGLE_SERVICE_ACCOUNT != 0 }}
if: ${{ always() && inputs.google-service-account != '' }}
env:
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_AUTH_TOKEN: ${{ inputs.github-token }}
JAVA_HOME: /usr/lib/jvm/default-jvm/
with:
storageType: gcs
Expand All @@ -72,11 +79,11 @@ runs:

# Jacoco
- name: "Set up Cloud SDK"
if: ${{ env.GOOGLE_SERVICE_ACCOUNT != 0 }}
if: ${{ inputs.google-service-account != '' }}
uses: "google-github-actions/setup-gcloud@v2"

- name: "Copy jacoco files"
if: ${{ env.GOOGLE_SERVICE_ACCOUNT != 0 }}
if: ${{ inputs.google-service-account != '' }}
shell: bash
run: |
mv build/reports/jacoco/testCodeCoverageReport build/reports/jacoco/test/
Expand All @@ -93,4 +100,4 @@ runs:
# Codecov
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ inputs.codecov-token }}
1 change: 1 addition & 0 deletions .github/actions/action-frontend-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ runs:
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }} # Using ref_name in case translations has committed something

- name: Npm install
shell: bash
working-directory: ui
Expand Down
6 changes: 6 additions & 0 deletions .github/actions/action-generate-translations/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ description: "Required the environment variable OPENAI_API_KEY to be set. This a

runs:
using: composite

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -16,9 +17,11 @@ runs:
python-version: "3.x"

- name: Install Python dependencies
shell: bash
run: pip install gitpython openai

- name: Generate translations
shell: bash
run: python ui/src/translations/generate_translations.py

- name: Set up Node
Expand All @@ -27,16 +30,19 @@ runs:
node-version: "20.x"

- name: Check keys matching
shell: bash
run: node ui/src/translations/check.js

- name: Set up Git
shell: bash
run: |
git config --global user.name "GitHub Action"
git config --global user.email "[email protected]"
- name: Check for changes and commit
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
git add ui/src/translations/*.json
if git diff --cached --quiet; then
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/workflow-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
name: File changes detection
runs-on: ubuntu-latest
timeout-minutes: 60
outputs:
ui: ${{ steps.changes.outputs.ui }}
translations: ${{ steps.changes.outputs.translations }}
backend: ${{ steps.changes.outputs.backend }}
steps:
- uses: dorny/paths-filter@v3
id: changes
Expand All @@ -40,11 +44,13 @@ jobs:
needs: file-changes
runs-on: ubuntu-latest
timeout-minutes: 60
if: "needs.file-changes.changes.outputs.ui == 'true'"
if: "needs.file-changes.outputs.ui == 'true'"
steps:
- uses: actions/checkout@v4

- id: generate-translations
name: Generate translations
if: "needs.file-changes.changes.outputs.translations == 'true'"
if: "needs.file-changes.outputs.translations == 'true'"
uses: ./.github/actions/action-generate-translations
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
Expand All @@ -58,16 +64,20 @@ jobs:
needs: file-changes
runs-on: ubuntu-latest
timeout-minutes: 60
if: needs.file-changes.changes.outputs.backend == 'true'
if: needs.file-changes.outputs.backend == 'true'
steps:
- uses: actions/checkout@v4

- name: Backend test
uses: ./.github/actions/action-backend-test

build-artifacts:
if: "needs.file-changes.changes.outputs.backend == 'true' || needs.file-changes.changes.outputs.ui == 'true'"
if: "needs.file-changes.outputs.backend == 'true' || needs.file-changes.outputs.ui == 'true'"
name: Build artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/action-build-artifacts
id: build-artifacts

Expand Down

0 comments on commit 40b9c78

Please sign in to comment.