From fb8552bbbf295cbf65fe6112c4ed4665abbdfdb6 Mon Sep 17 00:00:00 2001 From: Till! Date: Sun, 28 Jun 2020 22:16:07 +0200 Subject: [PATCH] Setup action (#6) * Update: Add definition for GitHub Action * Update: readme --- README.md | 42 +++++++++++++++++++++++++++++++++++------- action.yml | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 action.yml diff --git a/README.md b/README.md index 31d90e3..e3bb34d 100644 --- a/README.md +++ b/README.md @@ -2,23 +2,51 @@ # github-org-sync(-action) -`github-org-sync` is a little tool to sync files from a skeleton/template repository to other repositories in your organization. It works within a single organization, but of course it can be used multiple times. +`github-org-sync(-action)` is a tool to sync files from a skeleton/template repository to other repositories in your organization. It works within a single organization, but of course it can be used multiple times. + +It currently syncs `.github/workflows` — more is planned. Inspiration from: - https://github.com/cloudalchemy/auto-maintenance - https://github.com/prometheus/prometheus/blob/master/scripts/sync_repo_files.sh -### Status +## GitHub Action + +### Inputs + +#### `github-user` + +**Required** Name of the user to commit files and open PRs. + +#### `github-email` + +**Required** Email of the user to commit files and open PRs. + +#### `github-access-token` + +**Required** An access token (used for clone and push), scope repo. + +#### `github-org` + +**Required** Your Github organization. Default: `hostwithquantum` + +#### `github-skeleton` + +**Required** The base repository to sync files from. Default: `ansible-skeleton`. + +#### `github-repos` + +**Required** A (space-delimited) list of repositories to sync to. Default: `"ansible-weave"` -We currently provide a tool (written in Golang) to do the syncing. We sync files from `.github/workflows` only, more files/directories are planned and will be added when time permits. +## Standalone -The goal is to offer a GitHub Action as well. +If GitHub Actions are not applicable to your environment, you may run the tool without (and e.g. via `cron.d`). -## Getting it +### Getting it All releases are done using the amazing `goreleaser` in a release workflow in this repository. The workflow validates and builds binaries for different OS' and architectures and a Docker image (amd64) as well. -### Installing +#### Installing You may download a release for Mac, Linux or Windows here: - https://github.com/hostwithquantum/github-org-sync-action/releases @@ -28,7 +56,7 @@ To use the Docker image, please follow this link: Otherwise: `make dev` to build a snapshot. -### Configuration +#### Configuration - `github-org-sync` uses environment variables. There is nothing else currently. - See [.envrc-dist](.envrc-dist) for necessary configuration. diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..1179640 --- /dev/null +++ b/action.yml @@ -0,0 +1,35 @@ +name: 'GitHub Organization Sync(er)' +description: 'A GitHub Action to sync files across repositories' +inputs: + github-user: + description: Name of the user to commit files and open PRs. + required: true + github-email: + description: Email of the user to commit files and open PRs. + required: true + github-access-token: + description: An access token (used for clone and push), scope repo. + required: true + github-org: + description: Your Github organization. + required: true + default: hostwithquantum + github-skeleton: + description: The base repository to sync files from. + required: true + default: ansible-skeleton + github-repos: + description: A (space-delimited) list of repositories to sync to. + required: true + default: "ansible-weave" + +runs: + using: 'docker' + image: 'docker://docker.pkg.github.com/hostwithquantum/github-org-sync-action/github-org-sync:latest' + env: + GITHUB_USER: ${{ inputs.github-user }} + GITHUB_EMAIL: ${{ inputs.github-email }} + GITHUB_ACCESS_TOKEN: ${{ inputs.github-access-token }} + GITHUB_ORG: ${{ inputs.github-org }} + GITHUB_SKELETON: ${{ inputs.github-skeleton }} + GITHUB_REPOS: ${{ inputs.github-repos }}