-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
63 lines (61 loc) · 1.8 KB
/
commit-changes.yml
File metadata and controls
63 lines (61 loc) · 1.8 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
name: Commit Changes
on:
workflow_call:
inputs:
artifact-name:
description: Name of artifact containing changes.patch
required: true
type: string
commit-message:
description: Commit message
required: true
type: string
ref:
description: Git ref to checkout
required: false
type: string
default: ''
push-branch:
description: Branch to force push to; if unset, pushes to the checked-out branch without force
required: false
type: string
default: ''
secrets:
SELENIUM_CI_TOKEN:
required: false
jobs:
commit:
name: Commit Changes
runs-on: ubuntu-latest
permissions:
contents: write
actions: read
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ inputs.ref || github.ref }}
token: ${{ secrets.SELENIUM_CI_TOKEN || github.token }}
- name: Download patch
uses: actions/download-artifact@v8
with:
name: ${{ inputs.artifact-name }}
continue-on-error: true
- name: Apply and commit
run: |
git config --local user.email "selenium-ci@users.noreply.github.com"
git config --local user.name "Selenium CI Bot"
if [ -s changes.patch ]; then
git apply --index changes.patch
git commit -m "$COMMIT_MESSAGE"
if [ -n "$PUSH_BRANCH" ]; then
git push --force origin HEAD:"$PUSH_BRANCH"
else
git push
fi
else
echo "::notice::No changes.patch found or patch is empty; skipping commit and push."
fi
env:
COMMIT_MESSAGE: ${{ inputs.commit-message }}
PUSH_BRANCH: ${{ inputs.push-branch }}