mirror of
https://github.com/boostorg/boostlook.git
synced 2026-01-19 04:02:14 +00:00
gha: enhance workflow with permissions, Python setup, and PR automation
This commit is contained in:
committed by
Julio C. Estrada
parent
e35de5f6d6
commit
6ded0fa7d8
51
.github/workflows/update-website-v2.yml
vendored
51
.github/workflows/update-website-v2.yml
vendored
@@ -6,42 +6,65 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- 'boostlook.css'
|
- 'boostlook.css'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-css:
|
update-css:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout boostlook repository
|
- name: Checkout boostlook repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: boostorg/boostlook
|
||||||
|
|
||||||
- name: Checkout website-v2 repository
|
- name: Checkout website-v2 repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: boostorg/website-v2
|
repository: boostorg/website-v2
|
||||||
ref: develop
|
ref: develop
|
||||||
path: website-v2
|
path: website-v2
|
||||||
token: ${{ secrets.WEBSITE_V2_PAT }}
|
token: ${{ secrets.WEBSITE_V2_PAT }}
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
|
||||||
- name: Copy boostlook.css to website-v2
|
- name: Copy boostlook.css to website-v2
|
||||||
run: |
|
run: |
|
||||||
cp boostlook.css website-v2/static/css/boostlook.css
|
cp boostlook.css website-v2/static/css/boostlook.css
|
||||||
|
|
||||||
- name: Commit and push changes to a new branch
|
- name: Install pre-commit
|
||||||
|
if: success()
|
||||||
|
run: |
|
||||||
|
pip install pre-commit
|
||||||
|
|
||||||
|
- name: Run pre-commit hooks on boostlook.css
|
||||||
|
if: success()
|
||||||
working-directory: website-v2
|
working-directory: website-v2
|
||||||
|
run: |
|
||||||
|
pre-commit run --files static/css/boostlook.css
|
||||||
|
continue-on-error: false
|
||||||
|
|
||||||
|
- name: Commit and push changes to a new branch
|
||||||
|
if: success()
|
||||||
|
working-directory: website-v2
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.WEBSITE_V2_PAT }}
|
||||||
run: |
|
run: |
|
||||||
git config user.name "${{ github.actor }}"
|
git config user.name "${{ github.actor }}"
|
||||||
git config user.email "${{ github.actor }}@users.noreply.github.com"
|
git config user.email "${{ github.actor }}@users.noreply.github.com"
|
||||||
git add static/css/boostlook.css
|
git add static/css/boostlook.css
|
||||||
if ! git diff-index --quiet HEAD; then
|
if ! git diff-index --quiet HEAD; then
|
||||||
git commit -m "Update boostlook.css from boostlook repository"
|
git commit -m "Update boostlook.css from boostlook repository"
|
||||||
branch_name="update-boostlook-css-$(date +%Y%m%d%H%M%S)"
|
branch_name="update-boostlook-css-$(date +'%Y%m%d%H%M%S')"
|
||||||
git checkout -b $branch_name
|
git checkout -b "$branch_name"
|
||||||
git push origin $branch_name
|
git push origin "$branch_name"
|
||||||
|
gh pr create --title "Update boostlook.css from boostlook repository" \
|
||||||
|
--body "Automated PR to update boostlook.css" \
|
||||||
|
--base develop \
|
||||||
|
--head "$branch_name"
|
||||||
|
else
|
||||||
|
echo "No changes to commit. Skipping PR creation."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Create a pull request
|
|
||||||
working-directory: website-v2
|
|
||||||
run: |
|
|
||||||
gh pr create --title "Update boostlook.css from boostlook repository" \
|
|
||||||
--body "Automated PR to update boostlook.css" \
|
|
||||||
--base develop \
|
|
||||||
--head $branch_name
|
|
||||||
9
.pre-commit-config.yaml
Normal file
9
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v2.3.0
|
||||||
|
hooks:
|
||||||
|
- id: check-case-conflict
|
||||||
|
- id: check-merge-conflict
|
||||||
|
- id: check-yaml
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: trailing-whitespace
|
||||||
Reference in New Issue
Block a user