Skip to content

Commit 2642d47

Browse files
committed
Update README with local composite action example and correct parameters
1 parent 23ce912 commit 2642d47

File tree

1 file changed

+67
-47
lines changed

1 file changed

+67
-47
lines changed

.github/composite/docs/README.md

Lines changed: 67 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,73 @@
1-
# Action pull request another repository
2-
This GitHub Action copies a folder from the current repository to a location in another repository and create a pull request.
1+
# Copy and Pull Request to Another Repository
32

4-
This Action is a modified version of [paygoc6/action-pull-request-another-repo](https://github.com/paygoc6/action-pull-request-another-repo).
3+
This GitHub Action copies a folder from the current repository to a location in another repository and creates a pull request.
4+
5+
This is a local composite action based on [chkn/[email protected]](https://github.com/chkn/MDRCNY-Actions-CPR), which is a modified version of [paygoc6/action-pull-request-another-repo](https://github.com/paygoc6/action-pull-request-another-repo).
56

67
## Example Workflow
7-
name: Push File
8-
9-
on: push
10-
11-
jobs:
12-
pull-request:
13-
runs-on: ubuntu-latest
14-
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v2
17-
18-
- name: Create pull request
19-
uses: MDRCNY/[email protected]
20-
env:
21-
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
22-
with:
23-
source_folder: 'source-folder'
24-
destination_repo: 'user-name/repository-name'
25-
destination_folder: 'folder-name'
26-
destination_base_branch: 'branch-name'
27-
destination_head_branch: 'branch-name'
28-
user_email: '[email protected]'
29-
user_name: 'user-name'
30-
pull_request_reviewers: 'reviewers'
31-
title: 'title'
32-
body: 'body'
33-
34-
## Variables
35-
* source_folder: The folder to be moved. Uses the same syntax as the `cp` command. Incude the path for any files not in the repositories root directory.
36-
* destination_repo: The repository to place the file or directory in.
37-
* destination_folder: [optional] The folder in the destination repository to place the file in, if not the root directory.
38-
* user_email: The GitHub user email associated with the API token secret.
39-
* user_name: The GitHub username associated with the API token secret.
40-
* destination_base_branch: [optional] The branch into which you want your code merged. Default is `main`.
41-
* destination_head_branch: The branch to create to push the changes. Cannot be `master` or `main`.
42-
* pull_request_reviewers: [optional] The pull request reviewers. It can be only one (just like 'reviewer') or many (just like 'reviewer1,reviewer2,...')
43-
* title: [optional] The pull request title.
44-
* body: [optional] The pull request body.
45-
46-
## ENV
47-
* API_TOKEN_GITHUB: You must create a personal access token in you account. Follow the link:
48-
- [Personal access token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token)
49-
50-
> You must select the scopes: 'repo = Full control of private repositories', 'admin:org = read:org' and 'write:discussion = Read:discussion';
8+
9+
```yaml
10+
name: Copy Docs to Another Repo
11+
12+
on:
13+
push:
14+
branches:
15+
- main
16+
17+
jobs:
18+
copy-and-pr:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Copy files and create pull request
25+
uses: ./.github/composite/docs
26+
env:
27+
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
28+
with:
29+
source_path: 'api-reference'
30+
destination_repo: 'glideapps/other-repo'
31+
destination_path: 'docs/api'
32+
destination_base_branch: 'main'
33+
destination_head_branch: 'update-api-docs'
34+
user_email: '[email protected]'
35+
user_name: 'Glide Bot'
36+
label: 'automated-update'
37+
pull_request_reviewers: 'reviewer1,reviewer2'
38+
title: 'Update API docs from api-docs repo'
39+
body: 'Automated update of API documentation'
40+
```
41+
42+
## Inputs
43+
44+
* **source_path** (required): The folder or file to be copied. Uses the same syntax as the `cp` command. Include the path for any files not in the repository's root directory.
45+
* **destination_repo** (required): The repository to place the files in (format: `owner/repo-name`).
46+
* **destination_path** (optional): The folder in the destination repository to place the files in, if not the root directory.
47+
* **destination_head_branch** (required): The branch to create to push the changes. Cannot be `master` or `main`.
48+
* **destination_base_branch** (optional): The branch into which you want your code merged. Default is `main`.
49+
* **user_email** (required): The GitHub user email associated with the API token secret.
50+
* **user_name** (required): The GitHub username associated with the API token secret.
51+
* **label** (required): The label to apply to the pull request.
52+
* **pull_request_reviewers** (optional): The pull request reviewers. Can be a single reviewer (e.g., `reviewer`) or multiple comma-separated reviewers (e.g., `reviewer1,reviewer2`).
53+
* **title** (optional): The pull request title. Defaults to `Pull Request for Repo: <github.repository>`.
54+
* **body** (optional): The pull request body. Defaults to a single space.
55+
56+
## Outputs
57+
58+
* **pr_url**: The URL of the created pull request.
59+
* **created**: Boolean indicating whether the pull request was created (`true` or `false`).
60+
61+
## Environment Variables
62+
63+
* **API_TOKEN_GITHUB** (required): A GitHub Personal Access Token with the following scopes:
64+
- `repo` - Full control of private repositories
65+
- `admin:org` (read:org) - Read organization membership
66+
- `write:discussion` (read:discussion) - Read discussions
67+
68+
See [Creating a Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) for instructions.
69+
70+
Store this token as a repository secret and reference it in your workflow as shown in the example above.
5171

5272

5373
## Behavior Notes

0 commit comments

Comments
 (0)