gh-aw-firewall/{agent,api-proxy,squid} images emitted by tag only in v0.79.x lock files (digest pinning regressed; not covered by #36579 fix)
#20083
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Content Moderation | |
| on: | |
| issues: | |
| types: [opened] | |
| pull_request: | |
| types: [opened] | |
| issue_comment: | |
| types: [created] | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| moderate: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| if: vars.GH_AW_BLOCKED_USERS != '' | |
| steps: | |
| - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 | |
| env: | |
| BLOCKED_USERS: ${{ vars.GH_AW_BLOCKED_USERS || '' }} | |
| with: | |
| script: | | |
| const blocklist = (process.env.BLOCKED_USERS || '').split(',').map(u => u.trim()).filter(u => u); | |
| core.info(`Blocklist: ${blocklist.join(', ') || 'empty'}`); | |
| if (!blocklist.length) return; | |
| let user, number, commentId; | |
| if (context.eventName === 'issues') { | |
| user = context.payload.issue.user.login; | |
| number = context.payload.issue.number; | |
| } else if (context.eventName === 'pull_request') { | |
| user = context.payload.pull_request.user.login; | |
| number = context.payload.pull_request.number; | |
| } else if (context.eventName === 'issue_comment') { | |
| user = context.payload.comment.user.login; | |
| number = context.payload.issue.number; | |
| commentId = context.payload.comment.id; | |
| } | |
| core.info(`Checking user: ${user}`); | |
| if (!blocklist.includes(user)) { | |
| core.info(`User ${user} not in blocklist, skipping`); | |
| return; | |
| } | |
| core.info(`User ${user} is blocked, taking action`); | |
| if (commentId) { | |
| core.info(`Minimizing comment ${commentId}`); | |
| const comment = await github.rest.issues.getComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: commentId | |
| }); | |
| const nodeId = comment.data.node_id; | |
| await github.graphql( | |
| ` | |
| mutation($commentId: ID!) { | |
| minimizeComment(input: {subjectId: $commentId, classifier: SPAM}) { | |
| minimizedComment { | |
| isMinimized | |
| } | |
| } | |
| } | |
| `, | |
| { commentId: nodeId } | |
| ); | |
| } else if (context.eventName === 'issues') { | |
| core.info(`Closing issue #${number}`); | |
| await github.rest.issues.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: number, | |
| state: 'closed', | |
| state_reason: 'not_planned' | |
| }); | |
| } else if (context.eventName === 'pull_request') { | |
| core.info(`Closing PR #${number}`); | |
| await github.rest.pulls.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: number, | |
| state: 'closed' | |
| }); | |
| } |