-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (77 loc) · 2.89 KB
/
Copy pathdev_daily.yaml
File metadata and controls
92 lines (77 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Copyright (c) 2025-2026 ADBC Drivers Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This is a common workflow synchronizing workflows in driver repositories.
name: Dev (Daily)
on:
schedule:
- cron: 14 23 * * *
concurrency:
group: ${{ github.repository }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
sync_workflows:
name: Sync Workflows
runs-on: ubuntu-slim
if: github.repository_owner == 'adbc-drivers'
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
persist-credentials: true # for git operations below
- name: Install uv
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
- name: Re-generate workflows
run: |
echo "Generating workflows with adbc-gen-workflow..."
uvx --from git+https://github.com/adbc-drivers/dev.git adbc-gen-workflow generate $(pwd) || {
echo "ERROR: Failed to generate workflows"
exit 1
}
echo "Workflow generation completed successfully"
- name: Create PR if there are any changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ -n "$(git status --porcelain)" ]; then
PR_TITLE="chore: update generated workflows"
BRANCH="chore/workflows_$(date +%Y-%m-%d)"
# Skip if branch already exists on remote
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
echo "Branch $BRANCH already exists on remote. Skipping creating a new PR."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b "$BRANCH"
# Only add workflow files
git add .github/workflows/
git commit -m "update generated workflows"
git push origin "$BRANCH"
gh pr create \
--base main \
--head "$BRANCH" \
--title "$PR_TITLE" \
--body "" || {
echo "ERROR: Failed to create pull request"
exit 1
}
else
echo "No changes to commit. Skipping creating a PR."
fi