Removal of Advocates no longer at MSFT #296
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: Ensure pull requests against main | |
| on: | |
| pull_request_target: # Please read https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ before using | |
| types: [opened, edited] | |
| jobs: | |
| check_target_branch: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check PR target branch | |
| if: github.event.pull_request.base.ref == 'live' | |
| uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| // Get PR information | |
| const pr = context.payload.pull_request; | |
| // Update PR to target 'main' branch | |
| await github.rest.pulls.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: pr.number, | |
| base: 'main' | |
| }); | |
| // Create comment on PR | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: pr.number, | |
| body: 'All pull requests needs to be targeted to main for validation.\n\nPlease open pull requests against `main` in the future.' | |
| }); | |
| console.log('PR target branch was updated from live to main'); |