feat: BROS-87: Bitmask #577
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: "Check" | |
on: | |
pull_request: | |
types: | |
- opened | |
- edited | |
- reopened | |
- synchronize | |
- ready_for_review | |
branches: | |
- develop | |
- 'ls-release/**' | |
merge_group: | |
env: | |
ACTIONS_STEP_DEBUG: '${{ secrets.ACTIONS_STEP_DEBUG }}' | |
jobs: | |
version: | |
name: "Poetry Lock Change Size" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: hmarr/debug-action@v3.0.0 | |
- name: Validate | |
uses: actions/github-script@v7 | |
env: | |
BASE_REF: "${{ github.event.merge_group.base_sha || github.event.pull_request.base.sha || github.event.before }}" | |
HEAD_REF: "${{ github.event.merge_group.head_sha || github.event.pull_request.head.sha || github.event.after }}" | |
with: | |
github-token: ${{ secrets.GIT_PAT }} | |
script: | | |
const {repo, owner} = context.repo; | |
const base_ref = process.env.BASE_REF; | |
const head_ref = process.env.HEAD_REF; | |
const {data: compare} = await github.rest.repos.compareCommits({ | |
owner, | |
repo, | |
base: base_ref, | |
head: head_ref, | |
}); | |
const poetry_locks = compare.files.filter(e => e.filename.endsWith('poetry.lock')); | |
if (poetry_locks.length === 0) { | |
core.notice('No poetry.lock changes'); | |
} else { | |
for (const poetry_lock of poetry_locks) { | |
core.startGroup(`${poetry_lock.filename}`); | |
core.info(`${poetry_lock.filename} changed`); | |
console.log(poetry_lock); | |
if (poetry_lock.changes > 50) { | |
core.setFailed(`${poetry_lock.filename} has too many changes: ${poetry_lock.changes}`); | |
} | |
core.endGroup(); | |
} | |
} | |