From 0711da5c9421871e13df19aa5c5d6e94d3cf6960 Mon Sep 17 00:00:00 2001 From: erstarr <253168930+erstarr@users.noreply.github.com> Date: Sat, 8 Aug 2026 23:01:20 +0200 Subject: [PATCH 1/2] add vouch list and message for issues - change name of MR vouch list --- .github/vouch_issue_message.md | 5 ++ .github/workflows/close-issues.yml | 101 ----------------------------- .github/workflows/vouch-issues.yml | 42 ++++++++++++ .github/workflows/vouch-prs.yml | 6 +- 4 files changed, 50 insertions(+), 104 deletions(-) create mode 100644 .github/vouch_issue_message.md delete mode 100644 .github/workflows/close-issues.yml create mode 100644 .github/workflows/vouch-issues.yml diff --git a/.github/vouch_issue_message.md b/.github/vouch_issue_message.md new file mode 100644 index 00000000000..db0025a93b1 --- /dev/null +++ b/.github/vouch_issue_message.md @@ -0,0 +1,5 @@ +Users are no longer allowed to open issues themselves, please open a discussion instead. + +Please see the [wiki](https://wiki.hyprland.org/Contributing-and-Debugging/Issue-Guidelines/) on why this is the case.\n\nWe are volunteers, and we need your cooperation to make the best software we can. Thank you for understanding! ❤️ + +[Open a discussion here](https://github.com/hyprwm/Hyprland/discussions) \ No newline at end of file diff --git a/.github/workflows/close-issues.yml b/.github/workflows/close-issues.yml deleted file mode 100644 index 55f4e126ab9..00000000000 --- a/.github/workflows/close-issues.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: Close Unauthorized Issues - -on: - workflow_dispatch: - issues: - types: [opened] - -jobs: - close-unauthorized-issues: - runs-on: ubuntu-latest - permissions: - issues: write - steps: - # XXX: This *could* be done in Bash by abusing GitHub's own tool to interact with its API - # but that's too much of a hack, and we'll be adding a layer of abstraction. github-script - # is a workflow that eases interaction with GitHub API in the workflow run context. - - name: "Close 'unauthorized' issues" - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const ALLOWED_USERS = ['vaxerski', 'fufexan', 'NotAShelf']; - const CLOSING_COMMENT = 'Users are no longer allowed to open issues themselves, please open a discussion instead.\n\nPlease see the [wiki](https://wiki.hyprland.org/Contributing-and-Debugging/Issue-Guidelines/) on why this is the case.\n\nWe are volunteers, and we need your cooperation to make the best software we can. Thank you for understanding! ❤️\n\n[Open a discussion here](https://github.com/hyprwm/Hyprland/discussions)'; - - async function closeUnauthorizedIssue(issueNumber, userName) { - if (ALLOWED_USERS.includes(userName)) { - console.log(`Issue #${issueNumber} - Created by authorized user ${userName}`); - return; - } - - console.log(`Issue #${issueNumber} - Unauthorized, closing`); - - await github.rest.issues.update({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issueNumber, - state: 'closed', - state_reason: 'not_planned' - }); - - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issueNumber, - body: CLOSING_COMMENT - }); - } - - if (context.eventName === 'issues' && context.payload.action === 'opened') { - // Direct access to the issue that triggered the workflow - const issue = context.payload.issue; - - // Skip if this is a PR - if (issue.pull_request) { - console.log(`Issue #${issue.number} - Skipping, this is a pull request`); - return; - } - - // Process the single issue that triggered the workflow - await closeUnauthorizedIssue(issue.number, issue.user.login); - } else { - // For manual runs, we need to handle pagination - async function* fetchAllOpenIssues() { - let page = 1; - let hasNextPage = true; - - while (hasNextPage) { - const response = await github.rest.issues.listForRepo({ - owner: context.repo.owner, - repo: context.repo.repo, - state: 'open', - per_page: 100, - page: page - }); - - if (response.data.length === 0) { - hasNextPage = false; - } else { - for (const issue of response.data) { - yield issue; - } - page++; - } - } - } - - // Process issues one by one - for await (const issue of fetchAllOpenIssues()) { - try { - // Skip pull requests - if (issue.pull_request) { - console.log(`Issue #${issue.number} - Skipping, this is a pull request`); - continue; - } - - await closeUnauthorizedIssue(issue.number, issue.user.login); - } catch (error) { - console.error(`Error processing issue #${issue.number}: ${error.message}`); - } - } - } diff --git a/.github/workflows/vouch-issues.yml b/.github/workflows/vouch-issues.yml new file mode 100644 index 00000000000..bf08317c9d3 --- /dev/null +++ b/.github/workflows/vouch-issues.yml @@ -0,0 +1,42 @@ +name: Vouch Issue Check + +on: + issues: + types: [opened, reopened] + + +permissions: + contents: read + issues: write + +jobs: + check-vouch: + runs-on: ubuntu-latest + + steps: + - name: Check out template + uses: actions/checkout@v6 + with: + persist-credentials: false + + - name: Verify central Vouch list for Issues + env: + GH_TOKEN: ${{ github.token }} + run: | + gh api \ + "/repos/${{ github.repository_owner }}/.github/contents/vouch/VOUCHED_ISSUE.td?ref=${{ github.event.repository.default_branch }}" \ + >/dev/null + + - name: Enforce central Vouch list + uses: mitchellh/vouch/action/check-issue@v1 + with: + issue-number: ${{ github.event.issue.number }} + repo: ${{ github.repository }} + vouched-repo: ${{ github.repository_owner }}/.github + vouched-file: vouch/VOUCHED_ISSUE.td + template-file: .github/vouch_issue_message.md + require-vouch: true + auto-close: true + dry-run: false + env: + GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file diff --git a/.github/workflows/vouch-prs.yml b/.github/workflows/vouch-prs.yml index 0c2105c259e..9b74eb955c7 100644 --- a/.github/workflows/vouch-prs.yml +++ b/.github/workflows/vouch-prs.yml @@ -18,12 +18,12 @@ jobs: with: persist-credentials: false - - name: Verify central Vouch list + - name: Verify central Vouch list for MRs env: GH_TOKEN: ${{ github.token }} run: | gh api \ - "/repos/${{ github.repository_owner }}/.github/contents/vouch/VOUCHED.td?ref=${{ github.event.repository.default_branch }}" \ + "/repos/${{ github.repository_owner }}/.github/contents/vouch/VOUCHED_MR.td?ref=${{ github.event.repository.default_branch }}" \ >/dev/null - name: Enforce central Vouch list @@ -32,7 +32,7 @@ jobs: pr-number: ${{ github.event.pull_request.number }} repo: ${{ github.repository }} vouched-repo: ${{ github.repository_owner }}/.github - vouched-file: vouch/VOUCHED.td + vouched-file: vouch/VOUCHED_MR.td template-file: .github/vouch_pr_message.md require-vouch: true auto-close: true From f081a298a1f01f54fb8b8d9c6ef1b8cd6f6224fa Mon Sep 17 00:00:00 2001 From: erstarr <253168930+erstarr@users.noreply.github.com> Date: Sun, 9 Aug 2026 19:54:10 +0200 Subject: [PATCH 2/2] ihearthereisnocharacterlimitforthisfieldandithoughtheyiwonderifthatistrue --- .github/workflows/vouch-issues.yml | 2 +- .github/workflows/vouch-prs.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/vouch-issues.yml b/.github/workflows/vouch-issues.yml index bf08317c9d3..0227dc17bb1 100644 --- a/.github/workflows/vouch-issues.yml +++ b/.github/workflows/vouch-issues.yml @@ -19,7 +19,7 @@ jobs: with: persist-credentials: false - - name: Verify central Vouch list for Issues + - name: Verify central Issues Vouch list env: GH_TOKEN: ${{ github.token }} run: | diff --git a/.github/workflows/vouch-prs.yml b/.github/workflows/vouch-prs.yml index 9b74eb955c7..0c2105c259e 100644 --- a/.github/workflows/vouch-prs.yml +++ b/.github/workflows/vouch-prs.yml @@ -18,12 +18,12 @@ jobs: with: persist-credentials: false - - name: Verify central Vouch list for MRs + - name: Verify central Vouch list env: GH_TOKEN: ${{ github.token }} run: | gh api \ - "/repos/${{ github.repository_owner }}/.github/contents/vouch/VOUCHED_MR.td?ref=${{ github.event.repository.default_branch }}" \ + "/repos/${{ github.repository_owner }}/.github/contents/vouch/VOUCHED.td?ref=${{ github.event.repository.default_branch }}" \ >/dev/null - name: Enforce central Vouch list @@ -32,7 +32,7 @@ jobs: pr-number: ${{ github.event.pull_request.number }} repo: ${{ github.repository }} vouched-repo: ${{ github.repository_owner }}/.github - vouched-file: vouch/VOUCHED_MR.td + vouched-file: vouch/VOUCHED.td template-file: .github/vouch_pr_message.md require-vouch: true auto-close: true