Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for using oauth #24

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ inputs:
required: true
api-key:
description: "Tailscale API key"
required: true
required: false
oauth-client-id:
description: "Tailscale OAuth ID"
required: false
oauth-secret:
description: "Tailscale OAuth Secret"
required: false
policy-file:
description: "Path to policy file"
required: true
Expand All @@ -18,21 +24,23 @@ runs:
using: "composite"
steps:
- name: Check Auth Info Empty
if: ${{ inputs.api-key == '' }}
if: ${{ inputs['api-key'] == '' && inputs['oauth-secret'] == '' }}
shell: bash
run: |
echo "::error title=⛔ error hint::API Key empty. Maybe you need to populate it in the Secrets for your workflow, see more in https://docs.github.com/en/actions/security-guides/encrypted-secrets"
echo "::error title=⛔ error hint::API Key or OAuth secret must be specified. Maybe you need to populate it in the Secrets for your workflow, see more in https://docs.github.com/en/actions/security-guides/encrypted-secrets and https://tailscale.com/s/oauth-clients"
exit 1
- uses: actions/setup-go@v4.0.0
with:
go-version: 1.21.6
- shell: bash
env:
GOBIN: /usr/local/bin/
run: go install tailscale.com/cmd/gitops-pusher@gitops-1.30.0
run: go install tailscale.com/cmd/gitops-pusher@gitops-1.58.2

- shell: bash
env:
TS_API_KEY: "${{ inputs.api-key }}"
TS_OAUTH_ID: "${{ inputs.oauth-client-id }}"
TS_OAUTH_SECRET: "${{ inputs.oauth-secret }}"
TS_TAILNET: "${{ inputs.tailnet }}"
run: gitops-pusher "--policy-file=${{ inputs.policy-file }}" "${{ inputs.action }}"