A reusable GitHub Action that downloads workflow logs and uploads them to a GCP bucket.
-
GitHub App: Create a GitHub App with the following permissions:
- Repository permissions:
actions:read
,contents:read
- Install the app on repositories where you want to use this action
- Repository permissions:
-
GCP Service Account: Create a service account with permissions to write to Cloud Storage
- Set up Workload Identity Federation for keyless authentication
-
GCP Bucket: Create a Cloud Storage bucket (or use the Terraform in this project)
jobs:
my-job:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
id-token: write
steps:
# Your workflow steps here
- name: Build
run: make build
# Upload logs at the end
- name: Upload logs
if: always()
uses: airbytehq/upload-logs-action@v1
with:
gcp-workload-identity-provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
gcp-service-account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
gcp-bucket-uri: 'gs://my-bucket/prefix/'
github-app-id: ${{ secrets.GH_APP_ID }}
github-app-private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
Input | Description | Required | Default |
---|---|---|---|
gcp-workload-identity-provider |
GCP Workload Identity Provider | Yes | - |
gcp-service-account |
GCP Service Account email | Yes | - |
gcp-bucket-uri |
GCP bucket URI for storing logs (gs://bucket-name/path/) | Yes | - |
github-app-id |
GitHub App ID for authentication | Yes | - |
github-app-private-key |
GitHub App private key | Yes | - |
workflow-run-id |
Workflow run ID to download logs from | No | ${{ github.run_id }} |
workflow-name |
Workflow name for log file naming | No | ${{ github.workflow }} |
compress |
Compress logs with gzip before upload | No | true |
Add the following secrets to your repository:
GCP_WORKLOAD_IDENTITY_PROVIDER
: The full identifier for your Workload Identity ProviderGCP_SERVICE_ACCOUNT
: Email of the service accountGCP_LOGS_BUCKET_URI
: GCS bucket URI (e.g., gs://my-bucket/logs/)GH_APP_ID
: Your GitHub App IDGH_APP_PRIVATE_KEY
: Your GitHub App's private key (PEM format)
Elastic License 2.0