diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000000..114108a8bc --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,51 @@ +changed-files-labels-limit: 3 + +winget: + - changed-files: + - any-glob-to-any-file: + - src/UniGetUI.PackageEngine.Managers.WinGet/** + - src/WindowsPackageManager.Interop/** + +scoop: + - changed-files: + - any-glob-to-any-file: src/UniGetUI.PackageEngine.Managers.Scoop/** + +chocolatey: + - changed-files: + - any-glob-to-any-file: src/UniGetUI.PackageEngine.Managers.Chocolatey/** + +pip: + - changed-files: + - any-glob-to-any-file: src/UniGetUI.PackageEngine.Managers.Pip/** + +npm: + - changed-files: + - any-glob-to-any-file: src/UniGetUI.PackageEngine.Managers.Npm/** + +powershell: + - changed-files: + - any-glob-to-any-file: + - src/UniGetUI.PackageEngine.Managers.PowerShell/** + - src/UniGetUI.PackageEngine.Managers.PowerShell7/** + +cargo: + - changed-files: + - any-glob-to-any-file: src/UniGetUI.PackageEngine.Managers.Cargo/** + +dotnet-tool: + - changed-files: + - any-glob-to-any-file: src/UniGetUI.PackageEngine.Managers.Dotnet/** + +vcpkg: + - changed-files: + - any-glob-to-any-file: src/UniGetUI.PackageEngine.Managers.Vcpkg/** + +translations: + - changed-files: + - all-globs-to-any-file: + - src/Languages/lang_*.json + - "!src/Languages/lang_en.json" + +appearance: + - changed-files: + - any-glob-to-any-file: src/UniGetUI.Avalonia/Assets/Styles/** diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000000..97e9456269 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,24 @@ +changelog: + exclude: + labels: + - dependencies + - github_actions + authors: + - dependabot + - dependabot[bot] + categories: + - title: New features + labels: + - new-feature + - title: Improvements + labels: + - enhancement + - title: Bug fixes + labels: + - bug + - title: Translations + labels: + - translations + - title: Other changes + labels: + - "*" diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml new file mode 100644 index 0000000000..62a5c1000b --- /dev/null +++ b/.github/workflows/pr-labeler.yml @@ -0,0 +1,62 @@ +name: Pull Request Labeler + +on: + pull_request_target: + types: [opened, reopened, edited, synchronize, ready_for_review] + +concurrency: + group: pr-labeler-${{ github.event.pull_request.number }} + cancel-in-progress: true + +permissions: + contents: read + pull-requests: write + issues: read + +jobs: + label: + runs-on: ubuntu-latest + + steps: + - name: Label by changed files + uses: actions/labeler@v7 + + - name: Copy the type label from linked issues + uses: actions/github-script@v9 + with: + script: | + const typeLabels = ['bug', 'new-feature', 'enhancement']; + const { owner, repo } = context.repo; + const number = context.payload.pull_request.number; + + const result = await github.graphql(` + query($owner: String!, $repo: String!, $number: Int!) { + repository(owner: $owner, name: $repo) { + pullRequest(number: $number) { + labels(first: 100) { nodes { name } } + closingIssuesReferences(first: 20) { + nodes { labels(first: 50) { nodes { name } } } + } + } + } + }`, { owner, repo, number }); + + const pr = result.repository.pullRequest; + if (pr.labels.nodes.some(l => typeLabels.includes(l.name))) { + core.info('The pull request already has a type label.'); + return; + } + + const found = new Set( + pr.closingIssuesReferences.nodes + .flatMap(issue => issue.labels.nodes.map(l => l.name)) + .filter(name => typeLabels.includes(name))); + + if (found.size !== 1) { + core.info(`Linked issues carry ${found.size} distinct type labels; adding none.`); + return; + } + + const [label] = found; + await github.rest.issues.addLabels({ owner, repo, issue_number: number, labels: [label] }); + core.info(`Added '${label}' from the linked issues.`);