Skip to content

Commit

Permalink
bug fix version bump 0.7.1-draft (#305)
Browse files Browse the repository at this point in the history
* feat 🚀 add test for gitlab repo (#278)

* feat 🚀 add test for gitlab repo (#278)

* feat 🚀 add test for gitlab repo (#278)

* doc: 📝 document the usage of other git providers (#278)

* release(v0.7.1-draft): 🚀 bug fix release (#278)
  • Loading branch information
AndreasAugustin committed Feb 12, 2023
1 parent e8b7f32 commit 397291d
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions_template_sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: actions-template-sync
uses: AndreasAugustin/[email protected].0-draft
uses: AndreasAugustin/[email protected].1-draft
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_repo_path: AndreasAugustin/template
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/test_ssh_gitlab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: test-ssh-gitlab

on:
pull_request:
push:
# manual trigger
workflow_dispatch:

jobs:
test-implementation-job:

runs-on: ubuntu-latest

steps:
# To use this repository's private action, you must check out the repository
-
name: Checkout
uses: actions/checkout@v3
-
name: Test action step ssh
uses: ./ # Uses an action in the root directory
with:
hostname: ${{ secrets.SOURCE_REPO_GITLAB_HOSTNAME }}
github_token: ${{ secrets.GITHUB_TOKEN }}
source_repo_path: ${{ secrets.SOURCE_REPO_GITLAB_PATH }} # <owner/repo>, should be within secrets
source_repo_ssh_private_key: ${{ secrets.SOURCE_REPO_GITLAB_SSH_PRIVATE_KEY }} # contains the private ssh key of the private repository
is_dry_run: true
is_not_source_github: true
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@ This GitHub action will help you to keep track of the template changes.
* Ignore files and folders from syncing using a `.templatesyncignore` file
* many configuration options
* different lifecycle hooks are supported
* different git provider. Default is GitHub, GitLab is also tested. See [.github/workflows/test_ssh_gitlab.yml] for an example.

## Usage

### Update

starting with version v0.5.2-draft the `templateversionrc` file is not needed anymore. You can delete that file from the target repositories.

### Public template repository

Add this configuration to your github action
Expand All @@ -61,7 +58,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: actions-template-sync
uses: AndreasAugustin/[email protected].0-draft
uses: AndreasAugustin/[email protected].1-draft
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_repo_path: <owner/repo>
Expand Down Expand Up @@ -94,7 +91,7 @@ jobs:
private_key: ${{ secrets.PRIVATE_KEY }}

- name: actions-template-sync
uses: AndreasAugustin/[email protected].0-draft
uses: AndreasAugustin/[email protected].1-draft
with:
github_token: ${{ steps.generate_token.outputs.token }}
source_repo_path: <owner/repo>
Expand All @@ -109,6 +106,7 @@ An example are [deployment keys][deployment-keys]. For our use case write permis
Within the repository where the GitHub action is enabled add a secret (e.q. `SOURCE_REPO_SSH_PRIVATE_KEY`) with the content of your private SSH key.
Make sure that the read permissions of that secret fulfil your use case.
Set the optional `source_repo_ssh_private_key` input parameter.
It is also possible to use a different git provider, e.g. GitLab.

```yaml
jobs:
Expand All @@ -120,7 +118,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: actions-template-sync
uses: AndreasAugustin/[email protected].0-draft
uses: AndreasAugustin/[email protected].1-draft
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_repo_path: ${{ secrets.SOURCE_REPO_PATH }} # <owner/repo>, should be within secrets
Expand All @@ -144,6 +142,7 @@ jobs:
| hostname | `[optional]` the hostname of the repository | `false` | `github.com` |
| is_dry_run | `[optional]` set to `true` if you do not want to push the changes and not want to create a PR | `false` | |
| is_allow_hooks | `[optional]` set to `true` if you want to enable lifecycle hooks. Use this with caution! | `false` | `false` |
| is_not_source_github | `[optional]` set to `true` if the source git provider is not GitHub | `false` | `false` |

### Example

Expand Down Expand Up @@ -220,6 +219,10 @@ To ignore those, simply create a file in the root directory named `.templatesync
Open your project `Settings > Actions > General` and select the checkbox `Allow Github Actions to create and approve pull requests`
under the `Workflow permissions` section.

## Release Updates

starting with version v0.5.2-draft the `templateversionrc` file is not needed anymore. You can delete that file from the target repositories.

## Debug

You must create a secret named `ACTIONS_STEP_DEBUG` with the value `true` to see the debug messages set by this command in the log.
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ inputs:
is_allow_hooks:
description: '[optional] set to true if you want to allow hooks. Use this functionality with caution!'
default: 'false'
is_not_source_github:
description: '[optional] set to true if the source repository is not a github related repository. Useful e.q. if the source is GitLab'
default: 'false'
runs:
using: 'docker'
image: 'src/Dockerfile'
Expand All @@ -51,3 +54,4 @@ runs:
HOSTNAME: ${{ inputs.hostname }}
IS_DRY_RUN: ${{ inputs.is_dry_run }}
IS_ALLOW_HOOKS: ${{ inputs.is_allow_hooks }}
IS_NOT_SOURCE_GITHUB: ${{ inputs.is_not_source_github }}
10 changes: 8 additions & 2 deletions src/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,14 @@ function git_init() {
git config --global --add safe.directory /github/workspace
git lfs install

gh auth setup-git --hostname "${SOURCE_REPO_HOSTNAME}"
gh auth status --hostname "${SOURCE_REPO_HOSTNAME}"
if [[ -n "${IS_NOT_SOURCE_GITHUB}" ]]; then
info "the source repository is not located within GitHub."
ssh-keyscan -t rsa "${SOURCE_REPO_HOSTNAME}" >> /root/.ssh/known_hosts
else
info "the source repository is located within GitHub."
gh auth setup-git --hostname "${SOURCE_REPO_HOSTNAME}"
gh auth status --hostname "${SOURCE_REPO_HOSTNAME}"
fi
echo "::endgroup::"
}

Expand Down

0 comments on commit 397291d

Please sign in to comment.