name: PR auto-{approve,merge} on: pull_request_target: permissions: pull-requests: write contents: write jobs: dependabot: name: Dependabot runs-on: ubuntu-latest env: RAILS_ENV: test REDIS_URL: redis://localhost:6379/0 RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} SLACK_LOG_URL: http://slack.com/the_log_room # Service containers to run; note that this is duplicated # in test.yml due to a limitation in GitHub Actions # (services can only be defined per job) services: redis: # Docker Hub image name image: redis:6.2-alpine ports: ["6379:6379"] # Set health checks to wait until redis has started options: >- --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }} steps: - name: Fetch Dependabot metadata id: dependabot-metadata uses: dependabot/fetch-metadata@v1 with: github-token: "${{ secrets.GITHUB_TOKEN }}" - uses: actions/checkout@v3 with: ref: ${{ github.head_ref }} - uses: ./.github/actions/sisyphus - uses: ./.github/actions/license - name: Commit licenses run: | git add . git commit -m "[auto-license]: Update license information" || true git push - uses: ./.github/actions/sorbet - name: Commit Sorbet run: | git add . git commit -m "[auto-rbi]: Update RBI files" || true git push - name: Approve Dependabot PR if: ${{steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major'}} run: gh pr review --approve "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Merge Dependabot PR run: gh pr merge --auto --squash "$PR_URL" env: PR_URL: ${{ github.event.pull_request.html_url }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} sisyphusbot: name: Automated PRs runs-on: ubuntu-latest if: ${{ github.event.pull_request.user.login == 'sisyphusbot' }} steps: - uses: actions/checkout@v3 - name: Approve Automated PR if: startsWith(github.event.pull_request.title, '[auto') run: gh pr review --approve "$PR_URL" env: PR_URL: ${{ github.event.pull_request.html_url }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Merge Automated PR if: startsWith(github.event.pull_request.title, '[auto') run: gh pr merge --auto --squash "$PR_URL" env: PR_URL: ${{ github.event.pull_request.html_url }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}