You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 25, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+26-6Lines changed: 26 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ on:
14
14
workflow_dispatch: # Allow manual triggering
15
15
16
16
permissions:
17
-
contents: write # Needed to create releases
17
+
contents: write # Needed to push commits
18
18
pull-requests: write # Needed to create pull requests
19
19
20
20
jobs:
@@ -54,33 +54,51 @@ This action performs the following steps:
54
54
55
55
The action uses sparse checkout to minimize the amount of data that needs to be downloaded, making it efficient even with large template repositories.
56
56
57
-
The pull request creation step uses GitHub's REST API to check if a PR already exists for the branch and creates one if needed. This ensures that multiple workflow runs don't create duplicate PRs.
57
+
Pull requests are created using the peter-evans/create-pull-request action, which opens or updates a PR from the sync branch and avoids creating duplicates across runs. When a PR is created, the next step enables auto-merge using GitHub CLI (gh pr merge --merge --auto --delete-branch) so that approved PRs merge automatically and the branch is cleaned up.
58
+
59
+
### Auto-merge
60
+
61
+
After a PR is created, this action enables auto-merge when a PR number is available (condition: `steps.create-pr.outputs.pull-request-number != ''`). It uses GitHub CLI with:
This merges the PR once it meets merge requirements and deletes the branch afterward.
58
68
59
69
### GitHub Token Permissions
60
70
61
71
When using this action to sync workflow files (files in `.github/workflows/`), you need to be aware of GitHub's token permission restrictions:
62
72
63
-
1. **Default `GITHUB_TOKEN`**: Does not have permission to update workflow files in a repository. If you try to sync workflow files using the default token, you'll get an error like:
73
+
1. **Default `GITHUB_TOKEN`**: Does not have permission to update workflow files in a repository.
74
+
If you try to sync workflow files using the default token, you'll get an error like:
75
+
64
76
```
65
77
! [remote rejected] HEAD -> sync/update (refusing to allow a GitHub App to create or update workflow without `workflows` permission)
66
78
```
67
79
68
80
2. **Personal Access Token (PAT)**: To sync workflow files, you must use a PAT with the `workflow` scope. Configure this in your workflow:
81
+
69
82
```yaml
70
83
with:
71
84
token: ${{ secrets.PAT_WITH_WORKFLOW_SCOPE }}
72
85
```
73
86
74
87
3.**Repository Settings**: Alternatively, you can modify the default token permissions in your repository settings:
88
+
75
89
- Go to Settings > Actions > General
76
90
- Under "Workflow permissions", select "Read and write permissions"
77
91
- Check "Allow GitHub Actions to create and approve pull requests"
78
92
79
-
The action will automatically detect when workflow files are being modified and provide appropriate warnings.
93
+
The action will automatically detect when workflow files are being modified
94
+
and provide appropriate warnings.
80
95
81
96
### Configuration File
82
97
83
-
The action reads template configuration from a YAML file specified by the `source` parameter. This allows you to maintain template settings separately from your workflow files.
98
+
The action reads template configuration from a YAML file
99
+
specified by the `source` parameter.
100
+
This allows you to maintain template settings separately
101
+
from your workflow files.
84
102
85
103
Example configuration file (e.g., `template.yml`):
86
104
@@ -104,6 +122,7 @@ exclude: |
104
122
```
105
123
106
124
When using the configuration file:
125
+
107
126
1. You must specify the path to this file using the `source` parameter
108
127
2. The file must contain at least the `template-repository` value
109
128
3. Other values (`template-branch`, `include`, `exclude`) are optional
@@ -172,4 +191,5 @@ Contributions are welcome! Here's how you can contribute:
172
191
6. Push to the branch (`git push origin feature/amazing-feature`)
173
192
7. Open a Pull Request
174
193
175
-
Please make sure to update tests as appropriate and adhere to the existing coding style.
194
+
Please make sure to update tests as appropriate and adhere
0 commit comments