name: PR
on:
  pull_request_target:
    branches: [main]
    types: [opened]
jobs:
  close:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/github-script@v6
        with:
          script: |
            const fs = require('fs');
            console.log(await github.rest.issues.createComment({
              owner: context.repo.owner,
              repo: context.repo.repo,
              issue_number: context.issue.number,
              body: fs.readFileSync('CONTRIBUTING.md', { encoding: 'utf8', }),
            }));
            console.log(await github.rest.pulls.update({
              owner: context.repo.owner,
              repo: context.repo.repo,
              pull_number: context.issue.number,
              state: 'closed',
            }));
