diff --git a/.github/workflows/block-merge-eol.yml b/.github/workflows/block-merge-eol.yml new file mode 100644 index 0000000..4c217e3 --- /dev/null +++ b/.github/workflows/block-merge-eol.yml @@ -0,0 +1,58 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# +# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: Block merge to EOL + +on: pull_request + +permissions: + contents: read + +concurrency: + group: block-merge-eol-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + block-eol: + name: Block merge to EOL + runs-on: ubuntu-latest-low + steps: + - name: Parse base branch version + id: parse + run: | + branch="${{ github.base_ref }}" + if [[ $branch =~ ^stable([0-9]+)$ ]]; then + echo "major=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT + else + echo "skip=true" >> $GITHUB_OUTPUT + fi + + - name: Get current date + if: ${{ !steps.parse.outputs.skip }} + id: date + run: echo "date=$(date -u +'%Y-%m-%d')" >> $GITHUB_OUTPUT + + - name: Fetch EOL data + if: ${{ !steps.parse.outputs.skip }} + id: eol + run: | + data=$(curl -s https://raw.githubusercontent.com/nextcloud-releases/updater_server/production/config/major_versions.json) + eol=$(echo "$data" | jq -r ".[] | select(.majorVersion == ${{ steps.parse.outputs.major }}) | .eol") + echo "eol=$eol" >> $GITHUB_OUTPUT + + - name: Check EOL date + if: ${{ !steps.parse.outputs.skip }} + run: | + eol_date="${{ steps.eol.outputs.eol }}" + current_date="${{ steps.date.outputs.date }}" + if [[ "$eol_date" != "" && "$eol_date" != "null" ]]; then + if [[ "$eol_date" < "$current_date" || "$eol_date" == "$current_date" ]]; then + echo "This branch is EOL (End-of-Life) since $eol_date" + exit 1 + fi + fi diff --git a/.github/workflows/fixup.yml b/.github/workflows/fixup.yml index 69da2bb..dbaecdc 100644 --- a/.github/workflows/fixup.yml +++ b/.github/workflows/fixup.yml @@ -14,23 +14,19 @@ on: permissions: contents: read + pull-requests: write concurrency: group: fixup-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: - commit-message-check: - if: github.event.pull_request.draft == false - - permissions: - pull-requests: write - name: Block fixup and squash commits - + block-fixup-merge: runs-on: ubuntu-latest-low - + if: ${{ !github.event.pull_request.draft }} + name: block-fixup-merge steps: - - name: Run check + - name: Block fixup and squash commits uses: skjnldsv/block-fixup-merge-action@c138ea99e45e186567b64cf065ce90f7158c236a # v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/lint-info-xml.yml b/.github/workflows/lint-info-xml.yml index 736a895..5da422a 100644 --- a/.github/workflows/lint-info-xml.yml +++ b/.github/workflows/lint-info-xml.yml @@ -3,7 +3,7 @@ # https://github.com/nextcloud/.github # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization # -# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-FileCopyrightText: 2021-2026 Nextcloud GmbH and Nextcloud contributors # SPDX-License-Identifier: MIT name: Lint info.xml @@ -24,7 +24,9 @@ jobs: name: info.xml lint steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - name: Download schema run: wget https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/info.xsd diff --git a/.github/workflows/lint-php-cs.yml b/.github/workflows/lint-php-cs.yml index b6f1232..e253a33 100644 --- a/.github/workflows/lint-php-cs.yml +++ b/.github/workflows/lint-php-cs.yml @@ -6,7 +6,7 @@ # SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors # SPDX-License-Identifier: MIT -name: Lint php-cs +name: Lint code style on: pull_request @@ -20,29 +20,29 @@ concurrency: jobs: lint: runs-on: ubuntu-latest - - name: php-cs - + name: lint steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - name: Get php version id: versions - uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 + uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2 - - name: Set up php${{ steps.versions.outputs.php-available }} - uses: shivammathur/setup-php@2e947f1f6932d141d076ca441d0e1e881775e95b # v2.31.0 + - name: Set up php${{ steps.versions.outputs.php-min }} + uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0 with: - php-version: ${{ steps.versions.outputs.php-available }} + php-version: ${{ steps.versions.outputs.php-min }} extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite coverage: none ini-file: development env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install dependencies - run: composer i + - name: Install nextcloud/ocp + run: composer remove nextcloud/ocp --dev && composer i - - name: Lint - run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 ) + - name: Check code style + run: composer run cs:check || composer run cs:fix && git diff --exit-code diff --git a/.github/workflows/lint-php.yml b/.github/workflows/lint-php.yml index fc43037..867984f 100644 --- a/.github/workflows/lint-php.yml +++ b/.github/workflows/lint-php.yml @@ -6,7 +6,7 @@ # SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors # SPDX-License-Identifier: MIT -name: Lint php +name: Lint on: pull_request @@ -14,36 +14,40 @@ permissions: contents: read concurrency: - group: lint-php-${{ github.head_ref || github.run_id }} + group: lint-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: matrix: runs-on: ubuntu-latest-low + name: Determine PHP version outputs: php-versions: ${{ steps.versions.outputs.php-versions }} steps: - - name: Checkout app - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - name: Get version matrix + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Get PHP version id: versions - uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.0.0 + uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2 - php-lint: + lint: runs-on: ubuntu-latest needs: matrix strategy: matrix: - php-versions: ${{fromJson(needs.matrix.outputs.php-versions)}} - - name: php-lint - + php-versions: ${{ fromJson(needs.matrix.outputs.php-versions) }} + name: PHP-${{ matrix.php-versions }} steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@2e947f1f6932d141d076ca441d0e1e881775e95b # v2.31.0 + - name: Set up php${{ matrix.php-versions }} + uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0 with: php-version: ${{ matrix.php-versions }} extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite @@ -52,19 +56,17 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Install dependencies + run: composer i + - name: Lint run: composer run lint summary: - permissions: - contents: none runs-on: ubuntu-latest-low - needs: php-lint - + needs: lint if: always() - - name: php-lint-summary - + name: Lint summary steps: - - name: Summary status - run: if ${{ needs.php-lint.result != 'success' && needs.php-lint.result != 'skipped' }}; then exit 1; fi + - name: Check lint status + run: if [ "${{ needs.lint.result }}" != "success" ]; then exit 1; fi