generated from AndreasAugustin/template
-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gh-auth): add gh auth login and credential helper (#239)
* feat(gh-auth): add gh auth login and credential helper * feat(gh-auth): add own source_repo_github_token handling for template repo * chore(): add test for PAT 🚀 fix(): small fix for private repos 🐛 * chore(gh-cli): update gh cli version to latest 🚀 * # This is a combination of 6 commits. # This is the 1st commit message: parent 9b74224 author Andy Augustin <[email protected]> 1672219390 +0100 committer Andy Augustin <[email protected]> 1672592292 +0100 gpgsig -----BEGIN PGP SIGNATURE----- iQGzBAABCAAdFiEEApgnwt2TStNZl6Y9UpE0XzZ/UkgFAmOxu6QACgkQUpE0XzZ/ UkjAzgv/cWh9hE7VLkLM1nVmra945WUkOfWXHnCUnrsOWsxxSOkH1r2mLxZdnWtg BlFc4RciJAB39Nv1WBUt+hGBGOdYWcV1lxgSIpn+vNXd9/5xciEThRk9T1piHj+x xnZU2rW0dLlnEnFlIX1qkKeD+rjclXw46umjMgqwIF0vQSx5cR9y8sDCiqRGg2Fv G/k/xLoQwah0Ve8nwqd6dLwNYXl8cFBfvuZaGV/dt1+5BDl4J5mPYg4trxKx5xnB fTxTQ0G/qOa1OInW04EReJWZwQaGvyx5PqEFk0ESk8MuzFytfVVRCnHwdP/QvLO7 S7Y79wUBAQfHvSlwOgBtlQc5eFOiKoxahUhJIcCMLw1r2+nRjuPAA0j07v6nmjDM sfxyVSpnYnKGAfGrYGboOHuEjqKegKdY3oIQFL/Ivln7kmLxGrFcpQ+QMTEJUsLw 2AB+Yf+tJyQXnx8AiGQRnVlXW3FRCOQhCxK2zXMUpzwAsKcKYNnaKoM6jDN7EzRQ fZrB76EK =yGb3 -----END PGP SIGNATURE----- feat(): make gh auth login conditional for separate source repo token 🚀 style(lint): fix lint issues 🐛 feat(): add PAT 🚀 doc(): update docs 📝 feat(): add option for PAT 🚀 feat(): add option for PAT 🚀 * parent 9b74224 author Andy Augustin <[email protected]> 1672219390 +0100 committer Andy Augustin <[email protected]> 1672592292 +0100 gpgsig -----BEGIN PGP SIGNATURE----- iQGzBAABCAAdFiEEApgnwt2TStNZl6Y9UpE0XzZ/UkgFAmOxu6QACgkQUpE0XzZ/ UkjAzgv/cWh9hE7VLkLM1nVmra945WUkOfWXHnCUnrsOWsxxSOkH1r2mLxZdnWtg BlFc4RciJAB39Nv1WBUt+hGBGOdYWcV1lxgSIpn+vNXd9/5xciEThRk9T1piHj+x xnZU2rW0dLlnEnFlIX1qkKeD+rjclXw46umjMgqwIF0vQSx5cR9y8sDCiqRGg2Fv G/k/xLoQwah0Ve8nwqd6dLwNYXl8cFBfvuZaGV/dt1+5BDl4J5mPYg4trxKx5xnB fTxTQ0G/qOa1OInW04EReJWZwQaGvyx5PqEFk0ESk8MuzFytfVVRCnHwdP/QvLO7 S7Y79wUBAQfHvSlwOgBtlQc5eFOiKoxahUhJIcCMLw1r2+nRjuPAA0j07v6nmjDM sfxyVSpnYnKGAfGrYGboOHuEjqKegKdY3oIQFL/Ivln7kmLxGrFcpQ+QMTEJUsLw 2AB+Yf+tJyQXnx8AiGQRnVlXW3FRCOQhCxK2zXMUpzwAsKcKYNnaKoM6jDN7EzRQ fZrB76EK =yGb3 -----END PGP SIGNATURE----- feat(): make gh auth login conditional for separate source repo token 🚀 style(lint): fix lint issues 🐛 doc(): update docs 📝 feat(): add option for PAT 🚀 trial(): add permissions 🐛 trial(): new trial for accessing private repo with PAT 🆙 * feat(gh-auth): add gh auth login and credential helper * feat(gh-auth): add own source_repo_github_token handling for template repo * fix(merge): fix merge conflicts * fix(): small logic fix in script Signed-off-by: andy Augustin <[email protected]> * fix(): small logic fix in script Signed-off-by: andy Augustin <[email protected]> * Update test_ssh.yml Signed-off-by: andy Augustin <[email protected]> * Update test.yml Signed-off-by: andy Augustin <[email protected]> * Update entrypoint.sh Signed-off-by: andy Augustin <[email protected]> * fix(): fix for GITHUB_TOKEN env variable 🐛 * chore: code clean up Signed-off-by: andy Augustin <[email protected]> Co-authored-by: Andy Augustin <[email protected]> Co-authored-by: andy Augustin <[email protected]>
- Loading branch information
1 parent
2867179
commit 7a33121
Showing
8 changed files
with
87 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: test-pat | ||
|
||
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 PAT | ||
uses: ./ # Uses an action in the root directory | ||
with: | ||
github_token: ${{ secrets.SOURCE_REPO_PAT }} | ||
source_repo_path: ${{ secrets.SOURCE_REPO_PATH_TEST }} # <owner/repo>, should be within secrets | ||
is_dry_run: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,33 @@ You can use all [triggers][action-triggers] which are supported for GitHub actio | |
|
||
If you have a private template repository. | ||
|
||
#### Using github app | ||
|
||
You can create and use a [GitHub App][github-app] to handle the access to your private repository. | ||
To generate a token for your app you can use a separate action like [tibdex/github-app-token][github-app-token]. | ||
|
||
```yaml | ||
jobs: | ||
repo-sync: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Generate token to read from source repo # see: https://github.com/tibdex/github-app-token | ||
id: generate_token | ||
uses: tibdex/github-app-token@v1 | ||
with: | ||
app_id: ${{ secrets.APP_ID }} | ||
private_key: ${{ secrets.PRIVATE_KEY }} | ||
- name: actions-template-sync | ||
uses: AndreasAugustin/[email protected] | ||
with: | ||
github_token: ${{ steps.generate_token.outputs.token }} | ||
source_repo_path: <owner/repo> | ||
upstream_branch: <target_branch> # defaults to main | ||
pr_labels: <label1>,<label2>[,...] # optional, no default | ||
``` | ||
|
||
#### SSH | ||
|
||
You have various options to use ssh keys with GitHub. | ||
|
@@ -115,7 +142,7 @@ jobs: | |
|
||
## Ignore Files | ||
|
||
Create a `.templatesyncignore` file. Just like writing a `.gitignore` file, follow the [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)) | ||
Create a `.templatesyncignore` file. Just like writing a `.gitignore` file, follow the [glob pattern][glob-pattern] | ||
in defining the files and folders that should be excluded from syncing with the template repository. | ||
|
||
It can also be stored inside `.github` folder. | ||
|
@@ -184,3 +211,6 @@ specification. Contributions of any kind welcome! | |
[pr-labels]: https://docs.github.com/en/issues/using-labels-and-milestones-to-track-work/managing-labels | ||
[devto-example]: https://dev.to/andreasaugustin/github-actions-template-sync-1g9k | ||
[github-example]: https://github.com/AndreasAugustin/teaching/blob/main/docs/git/git_action_sync.md | ||
[github-app]: https://docs.github.com/en/developers/apps/getting-started-with-apps/about-apps#about-github-apps | ||
[glob-pattern]: https://en.wikipedia.org/wiki/Glob_(programming) | ||
[github-app-token]: https://github.com/tibdex/github-app-token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters