Skip to content

Commit

Permalink
fix(gha): reduce the amount of 1pass calls due to rate limiting
Browse files Browse the repository at this point in the history
  • Loading branch information
joryirving committed Jan 17, 2025
1 parent cf44793 commit 714d2e3
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 144 deletions.
14 changes: 2 additions & 12 deletions .github/workflows/bulk-merge-prs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,12 @@
name: Bulk Merge PRs
runs-on: ubuntu-latest
steps:
- name: Get Secrets
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.ONEPASS_SA_TOKEN }}
BOT_APP_ID: op://Kubernetes/github-bot/BOT_APP_ID
BOT_APP_PRIVATE_KEY: op://Kubernetes/github-bot/BOT_APP_PRIVATE_KEY
BOT_USERNAME: op://Kubernetes/github-bot/BOT_USERNAME

- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.BOT_APP_ID }}
private-key: ${{ env.BOT_APP_PRIVATE_KEY }}
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4
Expand Down
31 changes: 11 additions & 20 deletions .github/workflows/flux-diff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,13 @@ jobs:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.changed-clusters.outputs.all_changed_and_modified_files }}
github-token: ${{ steps.app-token.outputs.token }}
steps:
- name: Configure 1Password
uses: 1password/load-secrets-action/configure@v2
with:
service-account-token: ${{ secrets.ONEPASS_SA_TOKEN }}

- name: Get Secrets
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
BOT_APP_ID: op://Kubernetes/github-bot/BOT_APP_ID
BOT_APP_PRIVATE_KEY: op://Kubernetes/github-bot/BOT_APP_PRIVATE_KEY

- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.BOT_APP_ID }}
private-key: ${{ env.BOT_APP_PRIVATE_KEY }}
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

- name: Checkout Default Branch
uses: actions/checkout@v4
Expand Down Expand Up @@ -70,19 +56,24 @@ jobs:
resources: ["helmrelease", "kustomization"]
max-parallel: 4
fail-fast: false
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
steps:
- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

- name: Checkout Pull Request Branch
uses: actions/checkout@v4
with:
token: ${{ env.GITHUB_TOKEN }}
token: ${{ steps.app-token.outputs.token }}
path: pull

- name: Checkout Default Branch
uses: actions/checkout@v4
with:
token: ${{ env.GITHUB_TOKEN }}
token: ${{ steps.app-token.outputs.token }}
ref: ${{ github.event.repository.default_branch }}
path: default

Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/helm-repository-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@ jobs:
with:
export-env: true
env:
BOT_APP_ID: op://Kubernetes/github-bot/BOT_APP_ID
BOT_APP_PRIVATE_KEY: op://Kubernetes/github-bot/BOT_APP_PRIVATE_KEY
KUBECONFIG_BASE64: op://Kubernetes/kubernetes/KUBECONFIG_BASE64

- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.BOT_APP_ID }}
private-key: ${{ env.BOT_APP_PRIVATE_KEY }}
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/kustomization-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ jobs:
with:
export-env: true
env:
BOT_APP_ID: op://Kubernetes/github-bot/BOT_APP_ID
BOT_APP_PRIVATE_KEY: op://Kubernetes/github-bot/BOT_APP_PRIVATE_KEY
KUBECONFIG_BASE64: op://Kubernetes/kubernetes/KUBECONFIG_BASE64

- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.BOT_APP_ID }}
private-key: ${{ env.BOT_APP_PRIVATE_KEY }}
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4
Expand Down
17 changes: 2 additions & 15 deletions .github/workflows/labeler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,12 @@ jobs:
contents: read
pull-requests: write
steps:
- name: Configure 1password
uses: 1password/load-secrets-action/configure@v2
with:
service-account-token: ${{ secrets.ONEPASS_SA_TOKEN }}

- name: Get Secrets
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
BOT_APP_ID: op://Kubernetes/github-bot/BOT_APP_ID
BOT_APP_PRIVATE_KEY: op://Kubernetes/github-bot/BOT_APP_PRIVATE_KEY

- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.BOT_APP_ID }}
private-key: ${{ env.BOT_APP_PRIVATE_KEY }}
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

- name: Labeler
uses: actions/labeler@v5
Expand Down
17 changes: 2 additions & 15 deletions .github/workflows/lychee.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,12 @@ jobs:
name: Lychee
runs-on: ubuntu-latest
steps:
- name: Configure 1password
uses: 1password/load-secrets-action/configure@v2
with:
service-account-token: ${{ secrets.ONEPASS_SA_TOKEN }}

- name: Get Secrets
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
BOT_APP_ID: op://Kubernetes/github-bot/BOT_APP_ID
BOT_APP_PRIVATE_KEY: op://Kubernetes/github-bot/BOT_APP_PRIVATE_KEY

- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.BOT_APP_ID }}
private-key: ${{ env.BOT_APP_PRIVATE_KEY }}
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/nas-restart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@
with:
export-env: true
env:
BOT_APP_ID: op://Kubernetes/github-bot/BOT_APP_ID
BOT_APP_PRIVATE_KEY: op://Kubernetes/github-bot/BOT_APP_PRIVATE_KEY
KUBECONFIG: op://Kubernetes/kubernetes/KUBECONFIG_BASE64

- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.BOT_APP_ID }}
private-key: ${{ env.BOT_APP_PRIVATE_KEY }}
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4
Expand Down
26 changes: 9 additions & 17 deletions .github/workflows/pre-pull-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,13 @@ jobs:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.changed-clusters.outputs.all_changed_and_modified_files }}
github-token: ${{ steps.app-token.outputs.token }}
steps:
- name: Configure 1password
uses: 1password/load-secrets-action/configure@v2
with:
service-account-token: ${{ secrets.ONEPASS_SA_TOKEN }}

- name: Get Secrets
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
BOT_APP_ID: op://Kubernetes/github-bot/BOT_APP_ID
BOT_APP_PRIVATE_KEY: op://Kubernetes/github-bot/BOT_APP_PRIVATE_KEY

- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.BOT_APP_ID }}
private-key: ${{ env.BOT_APP_PRIVATE_KEY }}
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -77,11 +63,17 @@ jobs:
default: ${{ steps.extract-images.outputs.default }}
pull: ${{ steps.extract-images.outputs.pull }}
steps:
- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ env.GITHUB_TOKEN }}
token: ${{ steps.app-token.outputs.token }}
ref: "${{ matrix.branches == 'default' && github.event.repository.default_branch || '' }}"

- name: Gather Images
Expand Down
17 changes: 2 additions & 15 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,12 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- name: Configure 1password
uses: 1password/load-secrets-action/configure@v2
with:
service-account-token: ${{ secrets.ONEPASS_SA_TOKEN }}

- name: Get Secrets
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
BOT_APP_ID: op://Kubernetes/github-bot/BOT_APP_ID
BOT_APP_PRIVATE_KEY: op://Kubernetes/github-bot/BOT_APP_PRIVATE_KEY

- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.BOT_APP_ID }}
private-key: ${{ env.BOT_APP_PRIVATE_KEY }}
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

- name: Get Previous Release Tag and Determine Next Tag
id: determine-next-tag
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/schemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ jobs:
with:
export-env: true
env:
BOT_APP_ID: op://Kubernetes/github-bot/BOT_APP_ID
BOT_APP_PRIVATE_KEY: op://Kubernetes/github-bot/BOT_APP_PRIVATE_KEY
KUBECONFIG_BASE64: op://Kubernetes/kubernetes/KUBECONFIG_BASE64
CLOUDFLARE_API_TOKEN: op://Kubernetes/cloudflare/CLOUDFLARE_API_TOKEN_GHA
CLOUDFLARE_ACCOUNT_ID: op://Kubernetes/cloudflare/CLOUDFLARE_ACCOUNT_TAG
Expand All @@ -42,8 +40,8 @@ jobs:
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.BOT_APP_ID }}
private-key: ${{ env.BOT_APP_PRIVATE_KEY }}
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4
Expand Down
23 changes: 4 additions & 19 deletions .github/workflows/terraform-diff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,12 @@ jobs:
outputs:
matrix: ${{ steps.changed-terraform.outputs.all_changed_and_modified_files }}
steps:
- name: Configure 1password
uses: 1password/load-secrets-action/configure@v2
with:
service-account-token: ${{ secrets.ONEPASS_SA_TOKEN }}

- name: Get Secrets
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
BOT_APP_ID: op://Kubernetes/github-bot/BOT_APP_ID
BOT_APP_PRIVATE_KEY: op://Kubernetes/github-bot/BOT_APP_PRIVATE_KEY

- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.BOT_APP_ID }}
private-key: ${{ env.BOT_APP_PRIVATE_KEY }}
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -76,17 +63,15 @@ jobs:
with:
export-env: true
env:
BOT_APP_ID: op://Kubernetes/github-bot/BOT_APP_ID
BOT_APP_PRIVATE_KEY: op://Kubernetes/github-bot/BOT_APP_PRIVATE_KEY
MINIO_ACCESS_KEY: op://Kubernetes/minio/MINIO_ACCESS_KEY
MINIO_SECRET_KEY: op://Kubernetes/minio/MINIO_SECRET_KEY

- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.BOT_APP_ID }}
private-key: ${{ env.BOT_APP_PRIVATE_KEY }}
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4
Expand Down
17 changes: 2 additions & 15 deletions .github/workflows/terraform-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,12 @@ jobs:
contents: read
packages: write
steps:
- name: Configure 1password
uses: 1password/load-secrets-action/configure@v2
with:
service-account-token: ${{ secrets.ONEPASS_SA_TOKEN }}

- name: Get Secrets
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
BOT_APP_ID: op://Kubernetes/github-bot/BOT_APP_ID
BOT_APP_PRIVATE_KEY: op://Kubernetes/github-bot/BOT_APP_PRIVATE_KEY

- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.BOT_APP_ID }}
private-key: ${{ env.BOT_APP_PRIVATE_KEY }}
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4
Expand Down

0 comments on commit 714d2e3

Please sign in to comment.