mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-12-04 19:03:38 +00:00
ci: fix prevent prevent file change workflow (#6018)
This commit is contained in:
parent
52a89a515e
commit
48dfcfc0ed
27
.github/workflows/format-workflow.yml
vendored
27
.github/workflows/format-workflow.yml
vendored
@ -32,14 +32,29 @@ jobs:
|
|||||||
block-crowdin:
|
block-crowdin:
|
||||||
name: Block Translated Changes
|
name: Block Translated Changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref != 'i18n_master' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Prevent File Change
|
- name: Setup | Checkout
|
||||||
uses: xalvarez/prevent-file-change-action@v1.6.0
|
uses: actions/checkout@v4
|
||||||
if: ${{ github.event.pull_request.head.ref != 'i18n_master' }}
|
|
||||||
with:
|
with:
|
||||||
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
fetch-depth: 0
|
||||||
pattern: docs/[a-z][a-z][a-z]?-[A-Z][A-Z]?/.*
|
- name: Prevent File Change
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { execSync } = require('child_process');
|
||||||
|
const pattern = /^docs\/[a-z][a-z][a-z]?-[A-Z][A-Z]?\/.*$/;
|
||||||
|
const base = context.payload.pull_request.base.sha;
|
||||||
|
const head = context.payload.pull_request.head.sha;
|
||||||
|
|
||||||
|
const result = execSync(`git diff --name-only ${base} ${head}`).toString().split('\n');
|
||||||
|
|
||||||
|
for (const file of result) {
|
||||||
|
if (pattern.test(file)) {
|
||||||
|
core.setFailed(`To avoid conflicts, changes to the translated documentation are only allowed via Crowdin at https://translate.starship.rs.`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Vitepress build
|
# Vitepress build
|
||||||
vitepress:
|
vitepress:
|
||||||
|
Loading…
Reference in New Issue
Block a user