From 9b5930d7d86722cc8a173db4592bdcc8792f2431 Mon Sep 17 00:00:00 2001 From: DavidFair Date: Fri, 10 Nov 2023 15:12:21 +0000 Subject: Add GH Workflow for CI Tests (#10392) Co-authored-by: Cody Robibero --- .github/workflows/automation.yml | 78 ---------------- .github/workflows/ci-codeql-analysis.yml | 37 ++++++++ .github/workflows/ci-openapi.yml | 139 ++++++++++++++++++++++++++++ .github/workflows/ci-tests.yml | 50 ++++++++++ .github/workflows/codeql-analysis.yml | 37 -------- .github/workflows/issue-stale.yml | 35 +++++++ .github/workflows/openapi.yml | 139 ---------------------------- .github/workflows/project-automation.yml | 65 +++++++++++++ .github/workflows/pull-request-conflict.yml | 23 +++++ .github/workflows/pull-request-stale.yaml | 30 ++++++ .github/workflows/release-bump-version.yaml | 82 ++++++++++++++++ .github/workflows/repo-bump-version.yaml | 82 ---------------- .github/workflows/repo-stale.yaml | 54 ----------- 13 files changed, 461 insertions(+), 390 deletions(-) delete mode 100644 .github/workflows/automation.yml create mode 100644 .github/workflows/ci-codeql-analysis.yml create mode 100644 .github/workflows/ci-openapi.yml create mode 100644 .github/workflows/ci-tests.yml delete mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/issue-stale.yml delete mode 100644 .github/workflows/openapi.yml create mode 100644 .github/workflows/project-automation.yml create mode 100644 .github/workflows/pull-request-conflict.yml create mode 100644 .github/workflows/pull-request-stale.yaml create mode 100644 .github/workflows/release-bump-version.yaml delete mode 100644 .github/workflows/repo-bump-version.yaml delete mode 100644 .github/workflows/repo-stale.yaml (limited to '.github/workflows') diff --git a/.github/workflows/automation.yml b/.github/workflows/automation.yml deleted file mode 100644 index 47abce02a..000000000 --- a/.github/workflows/automation.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: Automation - -on: - push: - branches: - - master - pull_request_target: - issue_comment: - -permissions: {} -jobs: - label: - name: Labeling - runs-on: ubuntu-latest - if: ${{ github.repository == 'jellyfin/jellyfin' }} - steps: - - name: Apply label - uses: eps1lon/actions-label-merge-conflict@fd1f295ee7443d13745804bc49fe158e240f6c6e # tag=v2.1.0 - if: ${{ github.event_name == 'push' || github.event_name == 'pull_request_target'}} - with: - dirtyLabel: 'merge conflict' - commentOnDirty: 'This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged.' - repoToken: ${{ secrets.JF_BOT_TOKEN }} - - project: - name: Project board - runs-on: ubuntu-latest - if: ${{ github.repository == 'jellyfin/jellyfin' }} - steps: - - name: Remove from 'Current Release' project - uses: alex-page/github-project-automation-plus@7ffb872c64bd809d23563a130a0a97d01dfa8f43 # v0.8.3 - if: (github.event.pull_request || github.event.issue.pull_request) && !contains(github.event.*.labels.*.name, 'stable backport') - continue-on-error: true - with: - project: Current Release - action: delete - repo-token: ${{ secrets.JF_BOT_TOKEN }} - - - name: Add to 'Release Next' project - uses: alex-page/github-project-automation-plus@7ffb872c64bd809d23563a130a0a97d01dfa8f43 # v0.8.3 - if: (github.event.pull_request || github.event.issue.pull_request) && github.event.action == 'opened' - continue-on-error: true - with: - project: Release Next - column: In progress - repo-token: ${{ secrets.JF_BOT_TOKEN }} - - - name: Add to 'Current Release' project - uses: alex-page/github-project-automation-plus@7ffb872c64bd809d23563a130a0a97d01dfa8f43 # v0.8.3 - if: (github.event.pull_request || github.event.issue.pull_request) && !contains(github.event.*.labels.*.name, 'stable backport') - continue-on-error: true - with: - project: Current Release - column: In progress - repo-token: ${{ secrets.JF_BOT_TOKEN }} - - - name: Check number of comments from the team member - if: github.event.issue.pull_request == '' && github.event.comment.author_association == 'MEMBER' - id: member_comments - run: echo "::set-output name=number::$(curl -s ${{ github.event.issue.comments_url }} | jq '.[] | select(.author_association == "MEMBER") | .author_association' | wc -l)" - - - name: Move issue to needs triage - uses: alex-page/github-project-automation-plus@7ffb872c64bd809d23563a130a0a97d01dfa8f43 # v0.8.3 - if: github.event.issue.pull_request == '' && github.event.comment.author_association == 'MEMBER' && steps.member_comments.outputs.number <= 1 - continue-on-error: true - with: - project: Issue Triage for Main Repo - column: Needs triage - repo-token: ${{ secrets.JF_BOT_TOKEN }} - - - name: Add issue to triage project - uses: alex-page/github-project-automation-plus@7ffb872c64bd809d23563a130a0a97d01dfa8f43 # v0.8.3 - if: github.event.issue.pull_request == '' && github.event.action == 'opened' - continue-on-error: true - with: - project: Issue Triage for Main Repo - column: Pending response - repo-token: ${{ secrets.JF_BOT_TOKEN }} diff --git a/.github/workflows/ci-codeql-analysis.yml b/.github/workflows/ci-codeql-analysis.yml new file mode 100644 index 000000000..f43d743f0 --- /dev/null +++ b/.github/workflows/ci-codeql-analysis.yml @@ -0,0 +1,37 @@ +name: "CodeQL" + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: '24 2 * * 4' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + language: [ 'csharp' ] + + steps: + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Setup .NET + uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 + with: + dotnet-version: '7.0.x' + + - name: Initialize CodeQL + uses: github/codeql-action/init@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5 + with: + languages: ${{ matrix.language }} + queries: +security-extended + - name: Autobuild + uses: github/codeql-action/autobuild@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5 diff --git a/.github/workflows/ci-openapi.yml b/.github/workflows/ci-openapi.yml new file mode 100644 index 000000000..8c463a8fc --- /dev/null +++ b/.github/workflows/ci-openapi.yml @@ -0,0 +1,139 @@ +name: OpenAPI +on: + push: + branches: + - master + pull_request_target: + +permissions: {} + +jobs: + openapi-head: + name: OpenAPI - HEAD + runs-on: ubuntu-latest + permissions: read-all + steps: + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - name: Setup .NET + uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 + with: + dotnet-version: '7.0.x' + - name: Generate openapi.json + run: dotnet test tests/Jellyfin.Server.Integration.Tests/Jellyfin.Server.Integration.Tests.csproj -c Release --filter "Jellyfin.Server.Integration.Tests.OpenApiSpecTests" + - name: Upload openapi.json + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + with: + name: openapi-head + retention-days: 14 + if-no-files-found: error + path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net7.0/openapi.json + + openapi-base: + name: OpenAPI - BASE + if: ${{ github.base_ref != '' }} + runs-on: ubuntu-latest + permissions: read-all + steps: + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + fetch-depth: 0 + - name: Checkout common ancestor + env: + HEAD_REF: ${{ github.head_ref }} + run: | + git remote add upstream https://github.com/${{ github.event.pull_request.base.repo.full_name }} + git -c protocol.version=2 fetch --prune --progress --no-recurse-submodules upstream +refs/heads/*:refs/remotes/upstream/* +refs/tags/*:refs/tags/* + ANCESTOR_REF=$(git merge-base upstream/${{ github.base_ref }} origin/$HEAD_REF) + git checkout --progress --force $ANCESTOR_REF + - name: Setup .NET + uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 + with: + dotnet-version: '7.0.x' + - name: Generate openapi.json + run: dotnet test tests/Jellyfin.Server.Integration.Tests/Jellyfin.Server.Integration.Tests.csproj -c Release --filter "Jellyfin.Server.Integration.Tests.OpenApiSpecTests" + - name: Upload openapi.json + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + with: + name: openapi-base + retention-days: 14 + if-no-files-found: error + path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net7.0/openapi.json + + openapi-diff: + permissions: + pull-requests: write # to create or update comment (peter-evans/create-or-update-comment) + + name: OpenAPI - Difference + if: ${{ github.event_name == 'pull_request_target' }} + runs-on: ubuntu-latest + needs: + - openapi-head + - openapi-base + steps: + - name: Download openapi-head + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + with: + name: openapi-head + path: openapi-head + - name: Download openapi-base + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + with: + name: openapi-base + path: openapi-base + - name: Workaround openapi-diff issue + run: | + sed -i 's/"allOf"/"oneOf"/g' openapi-head/openapi.json + sed -i 's/"allOf"/"oneOf"/g' openapi-base/openapi.json + - name: Calculate OpenAPI difference + uses: docker://openapitools/openapi-diff + continue-on-error: true + with: + args: --fail-on-changed --markdown openapi-changes.md openapi-base/openapi.json openapi-head/openapi.json + - id: read-diff + name: Read openapi-diff output + run: | + body=$(cat openapi-changes.md) + body="${body//'%'/'%25'}" + body="${body//$'\n'/'%0A'}" + body="${body//$'\r'/'%0D'}" + echo ::set-output name=body::$body + - name: Find difference comment + uses: peter-evans/find-comment@a54c31d7fa095754bfef525c0c8e5e5674c4b4b1 # v2.4.0 + id: find-comment + with: + issue-number: ${{ github.event.pull_request.number }} + direction: last + body-includes: openapi-diff-workflow-comment + - name: Reply or edit difference comment (changed) + uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3.1.0 + if: ${{ steps.read-diff.outputs.body != '' }} + with: + issue-number: ${{ github.event.pull_request.number }} + comment-id: ${{ steps.find-comment.outputs.comment-id }} + edit-mode: replace + body: | + +
+ Changes in OpenAPI specification found. Expand to see details. + + ${{ steps.read-diff.outputs.body }} + +
+ - name: Edit difference comment (unchanged) + uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3.1.0 + if: ${{ steps.read-diff.outputs.body == '' && steps.find-comment.outputs.comment-id != '' }} + with: + issue-number: ${{ github.event.pull_request.number }} + comment-id: ${{ steps.find-comment.outputs.comment-id }} + edit-mode: replace + body: | + + + No changes to OpenAPI specification found. See history of this comment for previous changes. diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml new file mode 100644 index 000000000..f6cf859bc --- /dev/null +++ b/.github/workflows/ci-tests.yml @@ -0,0 +1,50 @@ +name: Tests +on: + push: + branches: + - master + # Run tests against the forked branch, but + # do not allow access to secrets + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflows-in-forked-repositories + pull_request: + +env: + SDK_VERSION: "7.0.x" + +jobs: + run-tests: + strategy: + matrix: + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + + runs-on: "${{ matrix.os }}" + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ env.SDK_VERSION }} + + - name: Run DotNet CLI Tests + run: > + dotnet test Jellyfin.sln + --configuration Release + --collect:"XPlat Code Coverage" + --settings tests/coverletArgs.runsettings + --verbosity minimal + + - name: Merge code coverage results + uses: danielpalme/ReportGenerator-GitHub-Action@5 + with: + reports: "**/coverage.cobertura.xml" + targetdir: "merged/" + reporttypes: "Cobertura" + + # TODO - which action / tool to use to publish code coverage results? + # - name: Publish code coverage results + + - name: Publish OpenAPI Artifact + uses: actions/upload-artifact@v3 + with: + name: "OpenAPI Spec" + path: "tests/Jellyfin.Server.Integration.Tests/bin/Release/net*/openapi.json" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index f43d743f0..000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - schedule: - - cron: '24 2 * * 4' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - language: [ 'csharp' ] - - steps: - - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Setup .NET - uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 - with: - dotnet-version: '7.0.x' - - - name: Initialize CodeQL - uses: github/codeql-action/init@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5 - with: - languages: ${{ matrix.language }} - queries: +security-extended - - name: Autobuild - uses: github/codeql-action/autobuild@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5 - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5 diff --git a/.github/workflows/issue-stale.yml b/.github/workflows/issue-stale.yml new file mode 100644 index 000000000..926a7fbfb --- /dev/null +++ b/.github/workflows/issue-stale.yml @@ -0,0 +1,35 @@ +name: Stale Issue Labeler + +on: + schedule: + - cron: '30 1 * * *' + workflow_dispatch: + +permissions: + issues: write + pull-requests: write + actions: write + +jobs: + issues: + name: Check for stale issues + runs-on: ubuntu-latest + if: ${{ contains(github.repository, 'jellyfin/') }} + steps: + - uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 # v8.0.0 + with: + repo-token: ${{ secrets.JF_BOT_TOKEN }} + ascending: true + days-before-stale: 120 + days-before-pr-stale: -1 + days-before-close: 21 + days-before-pr-close: -1 + operations-per-run: 500 + exempt-issue-labels: regression,security,roadmap,future,feature,enhancement,confirmed + stale-issue-label: stale + stale-issue-message: |- + This issue has gone 120 days without an update and will be closed within 21 days if there is no new activity. To prevent this issue from being closed, please confirm the issue has not already been fixed by providing updated examples or logs. + + If you have any questions you can use one of several ways to [contact us](https://jellyfin.org/contact). + close-issue-message: |- + This issue was closed due to inactivity. diff --git a/.github/workflows/openapi.yml b/.github/workflows/openapi.yml deleted file mode 100644 index 8c463a8fc..000000000 --- a/.github/workflows/openapi.yml +++ /dev/null @@ -1,139 +0,0 @@ -name: OpenAPI -on: - push: - branches: - - master - pull_request_target: - -permissions: {} - -jobs: - openapi-head: - name: OpenAPI - HEAD - runs-on: ubuntu-latest - permissions: read-all - steps: - - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Setup .NET - uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 - with: - dotnet-version: '7.0.x' - - name: Generate openapi.json - run: dotnet test tests/Jellyfin.Server.Integration.Tests/Jellyfin.Server.Integration.Tests.csproj -c Release --filter "Jellyfin.Server.Integration.Tests.OpenApiSpecTests" - - name: Upload openapi.json - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 - with: - name: openapi-head - retention-days: 14 - if-no-files-found: error - path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net7.0/openapi.json - - openapi-base: - name: OpenAPI - BASE - if: ${{ github.base_ref != '' }} - runs-on: ubuntu-latest - permissions: read-all - steps: - - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - - name: Checkout common ancestor - env: - HEAD_REF: ${{ github.head_ref }} - run: | - git remote add upstream https://github.com/${{ github.event.pull_request.base.repo.full_name }} - git -c protocol.version=2 fetch --prune --progress --no-recurse-submodules upstream +refs/heads/*:refs/remotes/upstream/* +refs/tags/*:refs/tags/* - ANCESTOR_REF=$(git merge-base upstream/${{ github.base_ref }} origin/$HEAD_REF) - git checkout --progress --force $ANCESTOR_REF - - name: Setup .NET - uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 - with: - dotnet-version: '7.0.x' - - name: Generate openapi.json - run: dotnet test tests/Jellyfin.Server.Integration.Tests/Jellyfin.Server.Integration.Tests.csproj -c Release --filter "Jellyfin.Server.Integration.Tests.OpenApiSpecTests" - - name: Upload openapi.json - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 - with: - name: openapi-base - retention-days: 14 - if-no-files-found: error - path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net7.0/openapi.json - - openapi-diff: - permissions: - pull-requests: write # to create or update comment (peter-evans/create-or-update-comment) - - name: OpenAPI - Difference - if: ${{ github.event_name == 'pull_request_target' }} - runs-on: ubuntu-latest - needs: - - openapi-head - - openapi-base - steps: - - name: Download openapi-head - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 - with: - name: openapi-head - path: openapi-head - - name: Download openapi-base - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 - with: - name: openapi-base - path: openapi-base - - name: Workaround openapi-diff issue - run: | - sed -i 's/"allOf"/"oneOf"/g' openapi-head/openapi.json - sed -i 's/"allOf"/"oneOf"/g' openapi-base/openapi.json - - name: Calculate OpenAPI difference - uses: docker://openapitools/openapi-diff - continue-on-error: true - with: - args: --fail-on-changed --markdown openapi-changes.md openapi-base/openapi.json openapi-head/openapi.json - - id: read-diff - name: Read openapi-diff output - run: | - body=$(cat openapi-changes.md) - body="${body//'%'/'%25'}" - body="${body//$'\n'/'%0A'}" - body="${body//$'\r'/'%0D'}" - echo ::set-output name=body::$body - - name: Find difference comment - uses: peter-evans/find-comment@a54c31d7fa095754bfef525c0c8e5e5674c4b4b1 # v2.4.0 - id: find-comment - with: - issue-number: ${{ github.event.pull_request.number }} - direction: last - body-includes: openapi-diff-workflow-comment - - name: Reply or edit difference comment (changed) - uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3.1.0 - if: ${{ steps.read-diff.outputs.body != '' }} - with: - issue-number: ${{ github.event.pull_request.number }} - comment-id: ${{ steps.find-comment.outputs.comment-id }} - edit-mode: replace - body: | - -
- Changes in OpenAPI specification found. Expand to see details. - - ${{ steps.read-diff.outputs.body }} - -
- - name: Edit difference comment (unchanged) - uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3.1.0 - if: ${{ steps.read-diff.outputs.body == '' && steps.find-comment.outputs.comment-id != '' }} - with: - issue-number: ${{ github.event.pull_request.number }} - comment-id: ${{ steps.find-comment.outputs.comment-id }} - edit-mode: replace - body: | - - - No changes to OpenAPI specification found. See history of this comment for previous changes. diff --git a/.github/workflows/project-automation.yml b/.github/workflows/project-automation.yml new file mode 100644 index 000000000..3637eb16a --- /dev/null +++ b/.github/workflows/project-automation.yml @@ -0,0 +1,65 @@ +name: Project Automation + +on: + push: + branches: + - master + pull_request_target: + issue_comment: + +permissions: {} +jobs: + project: + name: Project board + runs-on: ubuntu-latest + if: ${{ github.repository == 'jellyfin/jellyfin' }} + steps: + - name: Remove from 'Current Release' project + uses: alex-page/github-project-automation-plus@7ffb872c64bd809d23563a130a0a97d01dfa8f43 # v0.8.3 + if: (github.event.pull_request || github.event.issue.pull_request) && !contains(github.event.*.labels.*.name, 'stable backport') + continue-on-error: true + with: + project: Current Release + action: delete + repo-token: ${{ secrets.JF_BOT_TOKEN }} + + - name: Add to 'Release Next' project + uses: alex-page/github-project-automation-plus@7ffb872c64bd809d23563a130a0a97d01dfa8f43 # v0.8.3 + if: (github.event.pull_request || github.event.issue.pull_request) && github.event.action == 'opened' + continue-on-error: true + with: + project: Release Next + column: In progress + repo-token: ${{ secrets.JF_BOT_TOKEN }} + + - name: Add to 'Current Release' project + uses: alex-page/github-project-automation-plus@7ffb872c64bd809d23563a130a0a97d01dfa8f43 # v0.8.3 + if: (github.event.pull_request || github.event.issue.pull_request) && !contains(github.event.*.labels.*.name, 'stable backport') + continue-on-error: true + with: + project: Current Release + column: In progress + repo-token: ${{ secrets.JF_BOT_TOKEN }} + + - name: Check number of comments from the team member + if: github.event.issue.pull_request == '' && github.event.comment.author_association == 'MEMBER' + id: member_comments + run: echo "::set-output name=number::$(curl -s ${{ github.event.issue.comments_url }} | jq '.[] | select(.author_association == "MEMBER") | .author_association' | wc -l)" + + - name: Move issue to needs triage + uses: alex-page/github-project-automation-plus@7ffb872c64bd809d23563a130a0a97d01dfa8f43 # v0.8.3 + if: github.event.issue.pull_request == '' && github.event.comment.author_association == 'MEMBER' && steps.member_comments.outputs.number <= 1 + continue-on-error: true + with: + project: Issue Triage for Main Repo + column: Needs triage + repo-token: ${{ secrets.JF_BOT_TOKEN }} + + - name: Add issue to triage project + uses: alex-page/github-project-automation-plus@7ffb872c64bd809d23563a130a0a97d01dfa8f43 # v0.8.3 + if: github.event.issue.pull_request == '' && github.event.action == 'opened' + continue-on-error: true + with: + project: Issue Triage for Main Repo + column: Pending response + repo-token: ${{ secrets.JF_BOT_TOKEN }} diff --git a/.github/workflows/pull-request-conflict.yml b/.github/workflows/pull-request-conflict.yml new file mode 100644 index 000000000..05517bb03 --- /dev/null +++ b/.github/workflows/pull-request-conflict.yml @@ -0,0 +1,23 @@ +name: Merge Conflict Labeler + +on: + push: + branches: + - master + pull_request_target: + issue_comment: + +permissions: {} +jobs: + label: + name: Labeling + runs-on: ubuntu-latest + if: ${{ github.repository == 'jellyfin/jellyfin' }} + steps: + - name: Apply label + uses: eps1lon/actions-label-merge-conflict@fd1f295ee7443d13745804bc49fe158e240f6c6e # tag=v2.1.0 + if: ${{ github.event_name == 'push' || github.event_name == 'pull_request_target'}} + with: + dirtyLabel: 'merge conflict' + commentOnDirty: 'This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged.' + repoToken: ${{ secrets.JF_BOT_TOKEN }} diff --git a/.github/workflows/pull-request-stale.yaml b/.github/workflows/pull-request-stale.yaml new file mode 100644 index 000000000..de093a988 --- /dev/null +++ b/.github/workflows/pull-request-stale.yaml @@ -0,0 +1,30 @@ +name: Stale PR Check + +on: + schedule: + - cron: '30 */12 * * *' + workflow_dispatch: + +permissions: + pull-requests: write + actions: write + +jobs: + prs-stale-conflicts: + name: Check PRs with merge conflicts + runs-on: ubuntu-latest + if: ${{ contains(github.repository, 'jellyfin/') }} + steps: + - uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 # v8.0.0 + with: + repo-token: ${{ secrets.JF_BOT_TOKEN }} + ascending: true + operations-per-run: 150 + # The merge conflict action will remove the label when updated + remove-stale-when-updated: false + days-before-stale: -1 + days-before-close: 90 + days-before-issue-close: -1 + stale-pr-label: merge conflict + close-pr-message: |- + This PR has been closed due to having unresolved merge conflicts. diff --git a/.github/workflows/release-bump-version.yaml b/.github/workflows/release-bump-version.yaml new file mode 100644 index 000000000..e0383afd2 --- /dev/null +++ b/.github/workflows/release-bump-version.yaml @@ -0,0 +1,82 @@ +name: '🆙 Auto bump_version' + +on: + release: + types: + - published + workflow_dispatch: + inputs: + TAG_BRANCH: + required: true + description: release-x.y.z + NEXT_VERSION: + required: true + description: x.y.z + +jobs: + auto_bump_version: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'release' && !contains(github.event.release.tag_name, 'rc') }} + env: + TAG_BRANCH: ${{ github.event.release.target_commitish }} + steps: + - name: Wait for deploy checks to finish + uses: jitterbit/await-check-suites@292a541bb7618078395b2ce711a0d89cfb8a568a # v1 + with: + ref: ${{ env.TAG_BRANCH }} + intervalSeconds: 60 + timeoutSeconds: 3600 + + - name: Setup YQ + uses: chrisdickinson/setup-yq@latest + with: + yq-version: v4.9.8 + + - name: Checkout Repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + ref: ${{ env.TAG_BRANCH }} + + - name: Setup EnvVars + run: |- + CURRENT_VERSION=$(yq e '.version' build.yaml) + CURRENT_MAJOR_MINOR=${CURRENT_VERSION%.*} + CURRENT_PATCH=${CURRENT_VERSION##*.} + echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV + echo "CURRENT_MAJOR_MINOR=${CURRENT_MAJOR_MINOR}" >> $GITHUB_ENV + echo "CURRENT_PATCH=${CURRENT_PATCH}" >> $GITHUB_ENV + echo "NEXT_VERSION=${CURRENT_MAJOR_MINOR}.$(($CURRENT_PATCH + 1))" >> $GITHUB_ENV + + - name: Run bump_version + run: ./bump_version ${{ env.NEXT_VERSION }} + + - name: Commit Changes + run: |- + git config user.name "jellyfin-bot" + git config user.email "team@jellyfin.org" + git checkout ${{ env.TAG_BRANCH }} + git commit -am "Bump version to ${{ env.NEXT_VERSION }}" + git push origin ${{ env.TAG_BRANCH }} + + manual_bump_version: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'workflow_dispatch' }} + env: + TAG_BRANCH: ${{ github.event.inputs.TAG_BRANCH }} + NEXT_VERSION: ${{ github.event.inputs.NEXT_VERSION }} + steps: + - name: Checkout Repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + ref: ${{ env.TAG_BRANCH }} + + - name: Run bump_version + run: ./bump_version ${{ env.NEXT_VERSION }} + + - name: Commit Changes + run: |- + git config user.name "jellyfin-bot" + git config user.email "team@jellyfin.org" + git checkout ${{ env.TAG_BRANCH }} + git commit -am "Bump version to ${{ env.NEXT_VERSION }}" + git push origin ${{ env.TAG_BRANCH }} diff --git a/.github/workflows/repo-bump-version.yaml b/.github/workflows/repo-bump-version.yaml deleted file mode 100644 index e0383afd2..000000000 --- a/.github/workflows/repo-bump-version.yaml +++ /dev/null @@ -1,82 +0,0 @@ -name: '🆙 Auto bump_version' - -on: - release: - types: - - published - workflow_dispatch: - inputs: - TAG_BRANCH: - required: true - description: release-x.y.z - NEXT_VERSION: - required: true - description: x.y.z - -jobs: - auto_bump_version: - runs-on: ubuntu-latest - if: ${{ github.event_name == 'release' && !contains(github.event.release.tag_name, 'rc') }} - env: - TAG_BRANCH: ${{ github.event.release.target_commitish }} - steps: - - name: Wait for deploy checks to finish - uses: jitterbit/await-check-suites@292a541bb7618078395b2ce711a0d89cfb8a568a # v1 - with: - ref: ${{ env.TAG_BRANCH }} - intervalSeconds: 60 - timeoutSeconds: 3600 - - - name: Setup YQ - uses: chrisdickinson/setup-yq@latest - with: - yq-version: v4.9.8 - - - name: Checkout Repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ env.TAG_BRANCH }} - - - name: Setup EnvVars - run: |- - CURRENT_VERSION=$(yq e '.version' build.yaml) - CURRENT_MAJOR_MINOR=${CURRENT_VERSION%.*} - CURRENT_PATCH=${CURRENT_VERSION##*.} - echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV - echo "CURRENT_MAJOR_MINOR=${CURRENT_MAJOR_MINOR}" >> $GITHUB_ENV - echo "CURRENT_PATCH=${CURRENT_PATCH}" >> $GITHUB_ENV - echo "NEXT_VERSION=${CURRENT_MAJOR_MINOR}.$(($CURRENT_PATCH + 1))" >> $GITHUB_ENV - - - name: Run bump_version - run: ./bump_version ${{ env.NEXT_VERSION }} - - - name: Commit Changes - run: |- - git config user.name "jellyfin-bot" - git config user.email "team@jellyfin.org" - git checkout ${{ env.TAG_BRANCH }} - git commit -am "Bump version to ${{ env.NEXT_VERSION }}" - git push origin ${{ env.TAG_BRANCH }} - - manual_bump_version: - runs-on: ubuntu-latest - if: ${{ github.event_name == 'workflow_dispatch' }} - env: - TAG_BRANCH: ${{ github.event.inputs.TAG_BRANCH }} - NEXT_VERSION: ${{ github.event.inputs.NEXT_VERSION }} - steps: - - name: Checkout Repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ env.TAG_BRANCH }} - - - name: Run bump_version - run: ./bump_version ${{ env.NEXT_VERSION }} - - - name: Commit Changes - run: |- - git config user.name "jellyfin-bot" - git config user.email "team@jellyfin.org" - git checkout ${{ env.TAG_BRANCH }} - git commit -am "Bump version to ${{ env.NEXT_VERSION }}" - git push origin ${{ env.TAG_BRANCH }} diff --git a/.github/workflows/repo-stale.yaml b/.github/workflows/repo-stale.yaml deleted file mode 100644 index f9075ba03..000000000 --- a/.github/workflows/repo-stale.yaml +++ /dev/null @@ -1,54 +0,0 @@ -name: Stale Check - -on: - schedule: - - cron: '30 1 * * *' - workflow_dispatch: - -permissions: - issues: write - pull-requests: write - actions: write - -jobs: - issues: - name: Check for stale issues - runs-on: ubuntu-latest - if: ${{ contains(github.repository, 'jellyfin/') }} - steps: - - uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 # v8.0.0 - with: - repo-token: ${{ secrets.JF_BOT_TOKEN }} - ascending: true - days-before-stale: 120 - days-before-pr-stale: -1 - days-before-close: 21 - days-before-pr-close: -1 - operations-per-run: 500 - exempt-issue-labels: regression,security,roadmap,future,feature,enhancement,confirmed - stale-issue-label: stale - stale-issue-message: |- - This issue has gone 120 days without an update and will be closed within 21 days if there is no new activity. To prevent this issue from being closed, please confirm the issue has not already been fixed by providing updated examples or logs. - - If you have any questions you can use one of several ways to [contact us](https://jellyfin.org/contact). - close-issue-message: |- - This issue was closed due to inactivity. - - prs-conflicts: - name: Check PRs with merge conflicts - runs-on: ubuntu-latest - if: ${{ contains(github.repository, 'jellyfin/') }} - steps: - - uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 # v8.0.0 - with: - repo-token: ${{ secrets.JF_BOT_TOKEN }} - ascending: true - operations-per-run: 150 - # The merge conflict action will remove the label when updated - remove-stale-when-updated: false - days-before-stale: -1 - days-before-close: 90 - days-before-issue-close: -1 - stale-pr-label: merge conflict - close-pr-message: |- - This PR has been closed due to having unresolved merge conflicts. -- cgit v1.2.3