feat(server): add /metrics monitoring JSON endpoint #27
Workflow file for this run
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: Close PRs from organization forks | ||
|
Check warning on line 1 in .github/workflows/close-organization-fork-prs.yml
|
||
| on: | ||
| pull_request_target: | ||
| types: [opened, reopened] | ||
| permissions: | ||
| pull-requests: write | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: false | ||
| jobs: | ||
| close-organization-fork-pr: | ||
| if: >- | ||
| github.event.pull_request.head.repo.owner.type == 'Organization' && | ||
| github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| steps: | ||
| - name: Explain the contribution policy and close the PR | ||
| uses: actions/github-script@v9 | ||
| with: | ||
| script: | | ||
| const { data: pr } = await github.rest.pulls.get({ | ||
| ...context.repo, | ||
| pull_number: context.issue.number, | ||
| }); | ||
| const headRepo = pr.head.repo; | ||
| if (pr.state !== 'open' || !headRepo || | ||
| headRepo.id === pr.base.repo.id || headRepo.owner.type !== 'Organization') { | ||
| return; | ||
| } | ||
| const marker = '<!-- organization-fork-policy -->'; | ||
| const comments = await github.paginate(github.rest.issues.listComments, { | ||
| ...context.repo, | ||
| issue_number: pr.number, | ||
| per_page: 100, | ||
| }); | ||
| const alreadyExplained = comments.some(comment => | ||
| comment.user?.login === 'github-actions[bot]' && comment.body?.includes(marker)); | ||
| if (!alreadyExplained) { | ||
| await github.rest.issues.createComment({ | ||
| ...context.repo, | ||
| issue_number: pr.number, | ||
| body: [ | ||
| marker, | ||
| 'This repository requires contributions from forks to use a personal fork with **Allow edits from maintainers** enabled.', | ||
| 'GitHub does not support this option for organization-owned forks, so this PR is being closed automatically.', | ||
| 'Please open a new PR from a fork in your personal GitHub account and enable **Allow edits from maintainers** so maintainers can help update the branch.', | ||
| 'See [the GitHub documentation](https://docs.github.com/en/pull-requests/how-tos/work-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork).', | ||
| ].join('\n\n'), | ||
| }); | ||
| } | ||
| await github.rest.pulls.update({ | ||
| ...context.repo, | ||
| pull_number: pr.number, | ||
| state: 'closed', | ||
| }); | ||