Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ pkg/operator/crds/*.yaml linguist-generated=true
Makefile text eol=lf
tools/make/*.mk text eol=lf
tools/image-tag text eol=lf
tools/release text eol=lf
tools/mkrelease text eol=lf
71 changes: 0 additions & 71 deletions .github/workflows/backport.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/check-sync-module-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Set up Go
uses: actions/setup-go@v5
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/integration-tests-k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
with:
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/lint-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: PR Title Lint

on:
pull_request:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: read
id-token: write

jobs:
lint-pr-title:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- name: Get GitHub app secrets 🔐
id: get-secrets
uses: grafana/shared-workflows/actions/get-vault-secrets@a37de51f3d713a30a9e4b21bcdfbd38170020593 # get-vault-secrets/v1.3.0
with:
export_env: false
repo_secrets: |
ALLOYBOT_APP_ID=alloybot:app_id
ALLOYBOT_PRIVATE_KEY=alloybot:private_key

- name: Generate token 🔐
uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0
id: app-token
with:
app-id: ${{ fromJSON(steps.get-secrets.outputs.secrets).ALLOYBOT_APP_ID }}
private-key: ${{ fromJSON(steps.get-secrets.outputs.secrets).ALLOYBOT_PRIVATE_KEY }}
owner: grafana
repositories: alloy

- name: Validate PR title 🔎
uses: amannn/action-semantic-pull-request@e32d7e603df1aa1ba07e981f2a23455dee596825 # v5
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
with:
# Require conventional commit types
types: |
feat
fix
docs
style
refactor
perf
test
build
ci
chore
revert
# Scope is optional
requireScope: false
# Disallow uppercase first letter in subject
subjectPattern: ^[a-z].+$
subjectPatternError: |
The subject "{subject}" must start with a lowercase letter.
Example: "feat: add new component" not "feat: Add new component"
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
packaging,\
production,\
tools/ci,\
tools/release,\
tools/mkrelease,\
docs/sources/tutorials/assets\
"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-alloy-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,6 @@ jobs:

- name: Publish
run: |
VERSION="${GITHUB_REF_NAME}" RELEASE_DOC_TAG=$(echo "${GITHUB_REF_NAME}" | awk -F '.' '{print $1"."$2}') ./tools/release
VERSION="${GITHUB_REF_NAME}" RELEASE_DOC_TAG=$(echo "${GITHUB_REF_NAME}" | awk -F '.' '{print $1"."$2}') ./tools/mkrelease
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
94 changes: 94 additions & 0 deletions .github/workflows/release-backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Backport PR

on:
pull_request:
types: [labeled, closed]

permissions:
contents: write
pull-requests: write
id-token: write

jobs:
backport:
runs-on: ubuntu-latest
steps:
- name: Check if PR is merged and find backport labels 🏷️
id: check
uses: actions/github-script@v7
with:
script: |
const pr = context.payload.pull_request;

if (!pr.merged_at) {
console.log('PR is not merged, skipping');
core.setOutput('should_backport', 'false');
return;
}

const labels = pr.labels || [];
const backportLabels = labels
.map(l => l.name)
.filter(name => name.startsWith('backport/'));

if (backportLabels.length === 0) {
console.log('No backport labels found, skipping');
core.setOutput('should_backport', 'false');
return;
}

console.log(`PR is merged and has backport labels: ${backportLabels.join(', ')}`);
core.setOutput('labels', JSON.stringify(backportLabels));
core.setOutput('should_backport', 'true');

- name: Get GitHub app secrets 🔐
if: steps.check.outputs.should_backport == 'true'
id: get-secrets
uses: grafana/shared-workflows/actions/get-vault-secrets@a37de51f3d713a30a9e4b21bcdfbd38170020593 # get-vault-secrets/v1.3.0
with:
export_env: false
repo_secrets: |
ALLOYBOT_APP_ID=alloybot:app_id
ALLOYBOT_PRIVATE_KEY=alloybot:private_key

- name: Generate token 🔐
if: steps.check.outputs.should_backport == 'true'
uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0
id: app-token
with:
app-id: ${{ fromJSON(steps.get-secrets.outputs.secrets).ALLOYBOT_APP_ID }}
private-key: ${{ fromJSON(steps.get-secrets.outputs.secrets).ALLOYBOT_PRIVATE_KEY }}
owner: grafana
repositories: alloy

- name: Checkout repository 🛎️
if: steps.check.outputs.should_backport == 'true'
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 0
persist-credentials: false

- name: Set up Go 🏗️
if: steps.check.outputs.should_backport == 'true'
uses: actions/setup-go@v5
with:
go-version-file: tools/go.mod
cache-dependency-path: tools/go.sum

- name: Run backport tool 🍒
if: steps.check.outputs.should_backport == 'true'
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
LABELS: ${{ steps.check.outputs.labels }}
run: |
cd tools
labels='${LABELS}'

for label in $(echo "$labels" | jq -r '.[]'); do
echo "🍒 Processing backport for label: $label"
go run ./release/backport \
--pr "${{ github.event.pull_request.number }}" \
--label "$label"
done
62 changes: 62 additions & 0 deletions .github/workflows/release-create-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Create Release Branch

on:
workflow_dispatch:
inputs:
source_ref:
description: 'Source ref to branch from (default: main)'
required: false
default: 'main'
type: string
dry_run:
description: 'Dry run (do not create branch)'
type: boolean
default: true # For safety!

permissions:
contents: write
id-token: write

jobs:
create-branch:
runs-on: ubuntu-latest
steps:
- name: Get GitHub app secrets 🔐
id: get-secrets
uses: grafana/shared-workflows/actions/get-vault-secrets@a37de51f3d713a30a9e4b21bcdfbd38170020593 # get-vault-secrets/v1.3.0
with:
export_env: false
repo_secrets: |
ALLOYBOT_APP_ID=alloybot:app_id
ALLOYBOT_PRIVATE_KEY=alloybot:private_key

- name: Generate token 🔐
uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0
id: app-token
with:
app-id: ${{ fromJSON(steps.get-secrets.outputs.secrets).ALLOYBOT_APP_ID }}
private-key: ${{ fromJSON(steps.get-secrets.outputs.secrets).ALLOYBOT_PRIVATE_KEY }}
owner: grafana
repositories: alloy

- name: Checkout repository 🛎️
uses: actions/checkout@v4
with:
ref: ${{ inputs.source_ref }}
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
persist-credentials: false

- name: Set up Go 🏗️
uses: actions/setup-go@v5
with:
go-version-file: tools/go.mod
cache-dependency-path: tools/go.sum

- name: Run create-release-branch tool 🌿
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
SOURCE_REF: ${{ inputs.source_ref }}
run: |
cd tools
go run ./release/create-release-branch --source "${SOURCE_REF}" ${{ inputs.dry_run == true && '--dry-run' || '' }}
Loading
Loading