mirror of
https://github.com/cpina/github-action-push-to-another-repository.git
synced 2024-12-22 08:06:10 -07:00
Uses "main" branch instead of "master" for the examples, instructions, etc.
This commit is contained in:
parent
88287f5737
commit
3a9dc3773c
|
@ -4,7 +4,7 @@ When to use this GitHub Action? It is useful in case that you have a GitHub repo
|
||||||
|
|
||||||
Flow:
|
Flow:
|
||||||
|
|
||||||
The [example repository](https://github.com/cpina/push-to-another-repository-example) has a MarkDown file [main.md](https://github.com/cpina/push-to-another-repository-example/blob/master/main.md)), during the [GitHub Actions flow](https://github.com/cpina/push-to-another-repository-example/blob/master/.github/workflows/ci.yml#L19) it executes [build.sh](https://github.com/cpina/push-to-another-repository-example/blob/master/build.sh) and the output/ directory (configurable via [source-directory](https://github.com/cpina/push-to-another-repository-example/blob/master/.github/workflows/ci.yml#L27) appears in the [output repository](https://github.com/cpina/push-to-another-repository-output).
|
The [example repository](https://github.com/cpina/push-to-another-repository-example) has a MarkDown file [main.md](https://github.com/cpina/push-to-another-repository-example/blob/main/main.md)), during the [GitHub Actions flow](https://github.com/cpina/push-to-another-repository-example/blob/main/.github/workflows/ci.yml#L19) it executes [build.sh](https://github.com/cpina/push-to-another-repository-example/blob/main/build.sh) and the output/ directory (configurable via [source-directory](https://github.com/cpina/push-to-another-repository-example/blob/main/.github/workflows/ci.yml#L27) appears in the [output repository](https://github.com/cpina/push-to-another-repository-output).
|
||||||
|
|
||||||
Please bear in mind: files in the target repository are deleted. This is to make sure that it contains only the generated files in the last run without previously generated files.
|
Please bear in mind: files in the target repository are deleted. This is to make sure that it contains only the generated files in the last run without previously generated files.
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ The email that will be used for the commit in the destination-repository-name.
|
||||||
The Username/Organization for the destination repository, if different from `destination-github-username`. For the repository `https://github.com/cpina/push-to-another-repository-output` is `cpina`.
|
The Username/Organization for the destination repository, if different from `destination-github-username`. For the repository `https://github.com/cpina/push-to-another-repository-output` is `cpina`.
|
||||||
|
|
||||||
### `target-branch` (argument) [optional]
|
### `target-branch` (argument) [optional]
|
||||||
The branch name for the destination repository. It defaults to `master` for historical reasons, feel free to change it to `main`.
|
The branch name for the destination repository. It defaults to `main` for historical reasons, feel free to change it to `main`.
|
||||||
|
|
||||||
### `commit-message` (argument) [optional]
|
### `commit-message` (argument) [optional]
|
||||||
The commit message to be used in the output repository. Optional and defaults to "Update from $REPOSITORY_URL@commit".
|
The commit message to be used in the output repository. Optional and defaults to "Update from $REPOSITORY_URL@commit".
|
||||||
|
@ -54,7 +54,7 @@ Then make the token available to the Github Action following the steps:
|
||||||
## Example usage
|
## Example usage
|
||||||
```yaml
|
```yaml
|
||||||
- name: Pushes to another repository
|
- name: Pushes to another repository
|
||||||
uses: cpina/github-action-push-to-another-repository@master
|
uses: cpina/github-action-push-to-another-repository@main
|
||||||
env:
|
env:
|
||||||
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
|
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
|
||||||
with:
|
with:
|
||||||
|
@ -62,11 +62,12 @@ Then make the token available to the Github Action following the steps:
|
||||||
destination-github-username: 'cpina'
|
destination-github-username: 'cpina'
|
||||||
destination-repository-name: 'pandoc-test-output'
|
destination-repository-name: 'pandoc-test-output'
|
||||||
user-email: carles3@pina.cat
|
user-email: carles3@pina.cat
|
||||||
|
target-branch: main
|
||||||
```
|
```
|
||||||
|
|
||||||
Working example:
|
Working example:
|
||||||
|
|
||||||
https://github.com/cpina/push-to-another-repository-example/blob/master/.github/workflows/ci.yml
|
https://github.com/cpina/push-to-another-repository-example/blob/main/.github/workflows/ci.yml
|
||||||
|
|
||||||
It generates files from:
|
It generates files from:
|
||||||
https://github.com/cpina/push-to-another-repository-example
|
https://github.com/cpina/push-to-another-repository-example
|
||||||
|
|
|
@ -18,7 +18,7 @@ inputs:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
target-branch:
|
target-branch:
|
||||||
description: '[Optional] set target branch name for the destination repository. Defaults to "master"'
|
description: '[Optional] set target branch name for the destination repository. Defaults to "master" for historical reasons'
|
||||||
default: 'master'
|
default: 'master'
|
||||||
required: false
|
required: false
|
||||||
commit-message:
|
commit-message:
|
||||||
|
|
|
@ -37,12 +37,12 @@ then
|
||||||
echo "$SOURCE_DIRECTORY does not exist"
|
echo "$SOURCE_DIRECTORY does not exist"
|
||||||
echo "This directory needs to exist when push-to-another-repository is executed"
|
echo "This directory needs to exist when push-to-another-repository is executed"
|
||||||
echo
|
echo
|
||||||
echo "In the example it is created by ./build.sh: https://github.com/cpina/push-to-another-repository-example/blob/master/.github/workflows/ci.yml#L19"
|
echo "In the example it is created by ./build.sh: https://github.com/cpina/push-to-another-repository-example/blob/main/.github/workflows/ci.yml#L19"
|
||||||
echo
|
echo
|
||||||
echo "If you want to copy a directory that exist in the source repository"
|
echo "If you want to copy a directory that exist in the source repository"
|
||||||
echo "to the target repository: you need to clone the source repository"
|
echo "to the target repository: you need to clone the source repository"
|
||||||
echo "in a previous step in the same build section. For example using"
|
echo "in a previous step in the same build section. For example using"
|
||||||
echo "actions/checkout@v2. See: https://github.com/cpina/push-to-another-repository-example/blob/master/.github/workflows/ci.yml#L16"
|
echo "actions/checkout@v2. See: https://github.com/cpina/push-to-another-repository-example/blob/main/.github/workflows/ci.yml#L16"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user