Add Darksiders III #1635
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: Game Check | |
| on: | |
| pull_request_target: | |
| types: | |
| - opened | |
| jobs: | |
| greet: | |
| permissions: write-all | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Greet Pull Request | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const bannedUsers = JSON.parse(fs.readFileSync('./ban_list.json', 'utf8')); | |
| const username = context.actor; | |
| if (bannedUsers.includes(username)) { | |
| await github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `@${username}, you are not allowed to submit pull requests to this repository. Closing PR.` | |
| }); | |
| await github.rest.pulls.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.issue.number, | |
| state: "closed" | |
| }); | |
| core.setFailed(`User ${username} is blocked from making pull requests.`); | |
| return; | |
| } | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: 'Thanks for the pull request! I will look into the request and merge it upon success.' | |
| }) | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.8 | |
| - name: Install PyGithub | |
| run: | | |
| python -m pip install pygithub | |
| - name: Check files | |
| run: | | |
| python scripts/check_files.py | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| id: script_result | |
| - name: Set PR return message | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: '${{ env.ACTION_MESSAGE }}' | |
| }) | |
| - name: Accept pull request on success | |
| if: ${{ env.ACTION_STATUS == 'success' }} | |
| uses: pascalgn/automerge-action@v0.15.6 | |
| env: | |
| GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
| MERGE_LABELS: "" |