Skip to content

Commit 66df46b

Browse files
[TASK] Migrate workflows to shared reusable workflows from .github (#792) (#802)
(cherry picked from commit 6a4b690) Co-authored-by: Sebastian Mendel <info@sebastianmendel.de>
1 parent 43d2019 commit 66df46b

2 files changed

Lines changed: 9 additions & 78 deletions

File tree

.github/workflows/apply-precommit.yml

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -6,68 +6,5 @@ on:
66
workflow_dispatch:
77

88
jobs:
9-
lint:
10-
if: github.repository_owner == 'TYPO3-documentation'
11-
runs-on: ubuntu-latest
12-
permissions:
13-
contents: write # needed to push commit
14-
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
17-
with:
18-
token: ${{ secrets.GITHUB_TOKEN }}
19-
20-
- name: Set up Python
21-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
22-
with:
23-
python-version: '3.x'
24-
25-
- name: Install pre-commit
26-
run: pip install pre-commit
27-
28-
- name: Run pre-commit hooks and apply fixes
29-
id: pre-commit
30-
run: |
31-
# Run pre-commit with auto-fix and ignore exit code
32-
pre-commit run --all-files --hook-stage=manual --show-diff-on-failure || true
33-
# Check if any files were modified
34-
git diff --exit-code || echo "FIX_NEEDED=true" >> $GITHUB_ENV
35-
env:
36-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
38-
- name: Check for existing PR
39-
if: env.FIX_NEEDED == 'true'
40-
id: check_pr
41-
run: |
42-
EXISTING_PR=$(gh pr list --state open --search "Fix whitespace issues" --json number -q '.[].number')
43-
if [[ -n "$EXISTING_PR" ]]; then
44-
echo "EXISTING_PR=true" >> $GITHUB_ENV
45-
fi
46-
env:
47-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48-
49-
- name: Create and push changes if needed
50-
if: env.FIX_NEEDED == 'true' && env.EXISTING_PR != 'true'
51-
id: create_branch
52-
run: |
53-
git config user.name "github-actions[bot]"
54-
git config user.email "github-actions[bot]@users.noreply.github.com"
55-
# Create a new branch for the changes
56-
BRANCH_NAME="fix/whitespace-$(date +'%Y%m%d%H%M%S')"
57-
git checkout -b "$BRANCH_NAME"
58-
git add .
59-
git commit -m "fix: apply whitespace fixes"
60-
git push origin "$BRANCH_NAME"
61-
echo "branch_name=$BRANCH_NAME" >> $GITHUB_ENV
62-
env:
63-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64-
65-
- name: Open Pull Request
66-
if: env.FIX_NEEDED == 'true' && env.EXISTING_PR != 'true'
67-
uses: repo-sync/pull-request@7e79a9f5dc3ad0ce53138f01df2fad14a04831c5
68-
with:
69-
source_branch: ${{ env.branch_name }}
70-
destination_branch: ${{ github.ref_name }}
71-
pr_title: "Fix whitespace issues"
72-
pr_body: "This PR automatically applies whitespace fixes."
73-
token: ${{ secrets.GITHUB_TOKEN }}
9+
precommit:
10+
uses: TYPO3-Documentation/.github/.github/workflows/reusable-apply-precommit.yml@main
Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
name: test documentation
22

3-
on: [ push, pull_request ]
3+
on:
4+
push:
5+
pull_request:
46

57
jobs:
6-
tests:
7-
name: test-documentation
8-
runs-on: ubuntu-latest
9-
steps:
10-
- name: Checkout
11-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
12-
13-
- name: Test if the documentation will render without warnings
14-
run: |
15-
mkdir -p Documentation-GENERATED-temp \
16-
&& docker run --rm --pull always -v $(pwd):/project \
17-
ghcr.io/typo3-documentation/render-guides:latest --config=Documentation --no-progress --minimal-test
8+
render:
9+
uses: TYPO3-Documentation/.github/.github/workflows/reusable-test-documentation.yml@main
10+
with:
11+
render-flags: '--no-progress --minimal-test'

0 commit comments

Comments
 (0)