From 0776d394bc5dca838d27e20f760081f49f41d89e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 6 Jul 2022 11:51:30 +0200 Subject: [PATCH 1/6] Add GitHub action to check for a towncrier file --- .github/workflows/quality.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index d7f5ce8b57..9f3825f715 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -203,3 +203,26 @@ jobs: name: detekt-report path: | */build/reports/detekt/detekt.html + + towncrier: + name: Check that there is at least one file for the changelog + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.8 + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Install towncrier + run: | + python3 -m pip install towncrier + - name: Run towncrier + run: | + # Fetch the pull request' base branch so towncrier will be able to + # compare the current branch with the base branch. + # Source: https://github.com/actions/checkout/#fetch-all-branches. + git fetch --no-tags origin +refs/heads/${BASE_BRANCH}:refs/remotes/origin/${BASE_BRANCH} + towncrier check --compare-with origin/${BASE_BRANCH} + env: + BASE_BRANCH: ${{ github.base_ref }} + if: github.event_name == 'pull_request' From 1e0799d5b005358d695d017ca561068902a8e133 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 6 Jul 2022 11:53:13 +0200 Subject: [PATCH 2/6] shorter name --- .github/workflows/quality.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 9f3825f715..e4b06a6348 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -205,7 +205,7 @@ jobs: */build/reports/detekt/detekt.html towncrier: - name: Check that there is at least one file for the changelog + name: Towncrier check runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 1fd0fe504df84e5e157a373ff7e725751f6b8a20 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 11 Jul 2022 12:37:35 +0200 Subject: [PATCH 3/6] Format file --- .github/workflows/quality.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index e4b06a6348..0171831c18 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -21,7 +21,7 @@ jobs: - name: Run code quality check suite run: ./tools/check/check_code_quality.sh -# Knit for all the modules (https://github.com/Kotlin/kotlinx-knit) + # Knit for all the modules (https://github.com/Kotlin/kotlinx-knit) knit: name: Knit runs-on: ubuntu-latest @@ -31,7 +31,7 @@ jobs: run: | ./gradlew knit -# ktlint for all the modules + # ktlint for all the modules ktlint: name: Kotlin Linter runs-on: ubuntu-latest @@ -104,7 +104,7 @@ jobs: comment_id: ${{ steps.fc.outputs.comment-id }} }) -# Gradle dependency analysis using https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin + # Gradle dependency analysis using https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin dependency-analysis: name: Dependency analysis runs-on: ubuntu-latest @@ -123,7 +123,7 @@ jobs: name: dependency-analysis path: build/reports/dependency-check-report.html -# Lint for main module + # Lint for main module android-lint: name: Android Linter runs-on: ubuntu-latest @@ -151,7 +151,7 @@ jobs: path: | vector/build/reports/*.* -# Lint for Gplay and Fdroid release APK + # Lint for Gplay and Fdroid release APK apk-lint: name: Lint APK (${{ matrix.target }}) runs-on: ubuntu-latest From 63419fcf5e652f8e2b5a362be087093dd0e4601e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 11 Jul 2022 12:38:45 +0200 Subject: [PATCH 4/6] Do the check on towncrier only for PR targeting develop branch --- .github/workflows/quality.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 0171831c18..b971dfc1e4 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -207,6 +207,7 @@ jobs: towncrier: name: Towncrier check runs-on: ubuntu-latest + if: github.head_ref == 'develop' steps: - uses: actions/checkout@v3 - name: Set up Python 3.8 From 6feca4badf939353fab736bcf173cb684e28e854 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 11 Jul 2022 12:41:17 +0200 Subject: [PATCH 5/6] Indentation, move comment above the block. --- .github/workflows/quality.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index b971dfc1e4..f90a99a24b 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -218,12 +218,12 @@ jobs: run: | python3 -m pip install towncrier - name: Run towncrier - run: | # Fetch the pull request' base branch so towncrier will be able to # compare the current branch with the base branch. # Source: https://github.com/actions/checkout/#fetch-all-branches. - git fetch --no-tags origin +refs/heads/${BASE_BRANCH}:refs/remotes/origin/${BASE_BRANCH} - towncrier check --compare-with origin/${BASE_BRANCH} + run: | + git fetch --no-tags origin +refs/heads/${BASE_BRANCH}:refs/remotes/origin/${BASE_BRANCH} + towncrier check --compare-with origin/${BASE_BRANCH} env: BASE_BRANCH: ${{ github.base_ref }} if: github.event_name == 'pull_request' From d524f1a7d445768512337e07249a386b8c7aa1b1 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 11 Jul 2022 17:03:09 +0200 Subject: [PATCH 6/6] Group if together --- .github/workflows/quality.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index f90a99a24b..21d974602f 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -207,7 +207,7 @@ jobs: towncrier: name: Towncrier check runs-on: ubuntu-latest - if: github.head_ref == 'develop' + if: github.event_name == 'pull_request' && github.head_ref == 'develop' steps: - uses: actions/checkout@v3 - name: Set up Python 3.8 @@ -226,4 +226,3 @@ jobs: towncrier check --compare-with origin/${BASE_BRANCH} env: BASE_BRANCH: ${{ github.base_ref }} - if: github.event_name == 'pull_request'