Sync github push gha metrics source #1417
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
name: Sync github push gha metrics source | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
force-update-versions: | |
type: boolean | |
description: Force update-version job to run on non-main branch | |
required: true | |
default: false | |
schedule: | |
- cron: "0 */1 * * *" # Runs every hour | |
jobs: | |
update-version: | |
# Stop from automatically running on non-main branch when workflow was dispatched manually. | |
if: ${{ ((github.event.inputs.force-update-versions == 'true') || (github.head_ref == 'main') || (github.ref_name == 'main')) }} | |
permissions: | |
id-token: write | |
contents: write | |
pull-requests: write | |
actions: read | |
name: Update Version | |
runs-on: ubuntu-latest | |
steps: | |
- name: Collect Metrics | |
id: collect-gha-metrics | |
uses: goplugin/push-gha-metrics-action@dea9b546553cb4ca936607c2267a09c004e4ab3f # v3.0.0 | |
with: | |
id: update-version | |
basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} | |
hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }} | |
org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID}} | |
this-job-name: Update Version | |
continue-on-error: true | |
- name: Checkout the repo | |
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | |
- name: Update version | |
env: | |
GH_TOKEN: ${{ secrets.GHA_ACTIONS_SOURCE_PULL_TOKEN }} | |
run: ./sync-from-source/sync.sh | |
- name: Open PR | |
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5 | |
with: | |
title: Update push-gha-metrics-action | |
branch: chore/update-push-gha-metrics-action | |
commit-message: Update push-gha-metrics-action | |
update-snapshot: | |
permissions: | |
id-token: write | |
contents: write | |
pull-requests: write | |
actions: read # For push-gha-metrics-action | |
name: Update snapshot version | |
runs-on: ubuntu-latest | |
steps: | |
- name: Collect Metrics | |
id: collect-gha-metrics | |
uses: goplugin/push-gha-metrics-action@dea9b546553cb4ca936607c2267a09c004e4ab3f # v3.0.0 | |
with: | |
id: update-snapshot | |
basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} | |
hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }} | |
org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID}} | |
this-job-name: Update Version | |
continue-on-error: true | |
- name: Checkout the repo | |
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | |
with: | |
ref: snapshot | |
- name: Pull changes | |
env: | |
GH_TOKEN: ${{ secrets.GHA_ACTIONS_SOURCE_PULL_TOKEN }} | |
run: ./sync-from-source/sync.sh --snapshot | |
- name: Commit and push files | |
uses: planetscale/ghcommit-action@21a8cda29f55e5cc2cdae0cdbdd08e38dd148c25 # v0.1.37 | |
with: | |
commit_message: "Sync with push-gha-metrics-action-source@main" | |
repo: ${{ github.repository }} | |
branch: snapshot | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |