mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-14 00:42:17 +08:00
81 lines
2.9 KiB
YAML
81 lines
2.9 KiB
YAML
# trigger: 1
|
|
name: Apply macOS CI annotation cleanup
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev
|
|
paths:
|
|
- .github/workflows/apply-ci-quiet-macos-annotations.yml
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
apply:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout target branch
|
|
uses: actions/checkout@v5
|
|
with:
|
|
ref: fix/ci-quiet-macos-annotations-v2
|
|
path: target
|
|
persist-credentials: true
|
|
- name: Patch target workflow files
|
|
shell: bash
|
|
working-directory: target
|
|
run: |
|
|
set -euo pipefail
|
|
python3 - <<'PY'
|
|
from pathlib import Path
|
|
|
|
def patch_file(path: str) -> None:
|
|
p = Path(path)
|
|
text = p.read_text()
|
|
text = text.replace('os: macos-latest', 'os: macos-15')
|
|
quiet = ''' - name: Quiet Homebrew runner taps
|
|
if: startsWith(matrix.platform, 'darwin/')
|
|
shell: bash
|
|
run: |
|
|
brew untap aws/tap >/dev/null 2>&1 || true
|
|
|
|
'''
|
|
if 'Quiet Homebrew runner taps' not in text:
|
|
job_anchor = ' runs-on: ${{ matrix.os }}\n strategy:'
|
|
anchor_index = text.find(job_anchor)
|
|
if anchor_index < 0:
|
|
raise SystemExit(f'build job anchor not found in {path}')
|
|
marker = ' - name: Checkout code\n uses: actions/checkout@v5\n\n'
|
|
marker_index = text.find(marker, anchor_index)
|
|
if marker_index < 0:
|
|
raise SystemExit(f'build checkout marker not found in {path}')
|
|
insert_at = marker_index + len(marker)
|
|
text = text[:insert_at] + quiet + text[insert_at:]
|
|
p.write_text(text)
|
|
|
|
patch_file('.github/workflows/dev-build.yml')
|
|
patch_file('.github/workflows/release.yml')
|
|
PY
|
|
git diff --check
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git add .github/workflows/dev-build.yml .github/workflows/release.yml
|
|
git commit -m "ci: quiet macOS workflow annotations"
|
|
git push origin HEAD:fix/ci-quiet-macos-annotations-v2
|
|
- name: Checkout dev for cleanup
|
|
uses: actions/checkout@v5
|
|
with:
|
|
ref: dev
|
|
path: cleanup
|
|
persist-credentials: true
|
|
- name: Remove temporary workflow from dev
|
|
shell: bash
|
|
working-directory: cleanup
|
|
run: |
|
|
set -euo pipefail
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git rm .github/workflows/apply-ci-quiet-macos-annotations.yml
|
|
git commit -m "chore: remove temporary macOS CI annotation cleanup workflow"
|
|
git push origin HEAD:dev
|