This commit is contained in:
Harsh Shandilya 2023-01-12 16:32:58 +05:30
parent 9b32dc594e
commit 1a25a724d1
No known key found for this signature in database
2 changed files with 15 additions and 12 deletions

View File

@ -3,7 +3,7 @@ module.exports = async ({github, context}) => {
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
pull_number: context.payload.number,
}).data;
});
console.log(Object.getOwnPropertyNames(pr));
const shouldWarn = pr.head.ref != "staging" && pr.base.ref == "main";

View File

@ -15,15 +15,18 @@ jobs:
check-pr-base:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Validate PR head and base branches
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
id: validate-pr-base
with:
result-encoding: string
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const script = require('.github/check-pr-base.js')
return await script({github, context})
if: "${{ github.base_ref == 'refs/heads/main' && github.head_ref != 'refs/heads/staging' }}"
run: exit 1
# - name: Checkout repository
# uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
#
# - name: Validate PR head and base branches
# uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
# id: validate-pr-base
# with:
# result-encoding: string
# github-token: ${{ secrets.GITHUB_TOKEN }}
# script: |
# const script = require('.github/check-pr-base.js')
# return await script({github, context})