Skip to content

Commit c6bc70e

Browse files
authored
Update workflows (#1307)
* Update workflows * Update workflow
1 parent 3d980fe commit c6bc70e

File tree

5 files changed

+33
-20
lines changed

5 files changed

+33
-20
lines changed

.github/workflows/check-grafana-compatibility.yml

+13-9
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,34 @@ jobs:
1414
buildPR:
1515
name: Build PR
1616
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
1719
steps:
18-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1921
with:
22+
persist-credentials: false
2023
path: './grafana-plugin-sdk-go'
21-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2225
with:
26+
persist-credentials: false
2327
repository: 'grafana/grafana'
2428
path: './grafana'
25-
- uses: actions/setup-go@v5
29+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # 5.3.0
2630
with:
2731
cache: false
2832
go-version: '~1.22'
2933
check-latest: true
3034

3135
- name: Check if branch exists in Grafana
3236
working-directory: './grafana'
37+
env:
38+
BRANCH: ${{ github.head_ref }}
3339
run: |
34-
if git ls-remote --heads --quiet --exit-code origin ${{ github.head_ref }}
35-
then
36-
echo "Found branch ${{ github.head_ref }} in Grafana"
37-
git fetch origin ${{ github.head_ref }}
38-
git checkout ${{ github.head_ref }}
40+
if git ls-remote --heads --quiet --exit-code origin "$BRANCH"; then
41+
echo "Found branch $BRANCH in Grafana"
42+
git fetch origin "$BRANCH" && git checkout "$BRANCH"
3943
else
40-
echo "Branch ${{ github.head_ref }} not found in Grafana"
44+
echo "Branch $BRANCH not found in Grafana"
4145
fi
4246
4347
- name: Link sdk

.github/workflows/check-incompatibility.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ on:
1414
jobs:
1515
main:
1616
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
1719
steps:
18-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1921
with:
22+
persist-credentials: false
2023
path: './grafana-plugin-sdk-go'
21-
- uses: actions/setup-go@v5
24+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # 5.3.0
2225
with:
2326
cache: false
2427
check-latest: true

.github/workflows/ci.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,26 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Checkout
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
with:
23+
persist-credentials: false
2224

2325
- name: Setup go
24-
uses: actions/setup-go@v5
26+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # 5.3.0
2527
with:
2628
go-version-file: ./go.mod
2729

2830
- name: Run golangci-lint
29-
uses: golangci/golangci-lint-action@v6
31+
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
3032
with:
31-
version: ${{env.GOLANGCI_LINT_VERSION}}
33+
version: ${GOLANGCI_LINT_VERSION}
3234
args: |
3335
"./..." --timeout=7m
3436
skip-cache: true
3537
install-mode: binary
3638

3739
- name: Setup Mage
38-
uses: magefile/mage-action@v3
40+
uses: magefile/mage-action@6f50bbb8ea47d56e62dee92392788acbc8192d0b # v3
3941
with:
4042
install-only: true
4143

.github/workflows/stale.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
stale:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/stale@v9
12+
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9
1313
with:
1414
# Number of days of inactivity before a stale Issue or Pull Request is closed.
1515
# Set to -1 to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.

.github/workflows/validate-protos.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ on:
1212
jobs:
1313
main:
1414
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
1517
steps:
1618
# Run `git checkout`
17-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20+
with:
21+
persist-credentials: false
1822
# Install the `buf` CLI
19-
- uses: bufbuild/buf-setup-action@v1
23+
- uses: bufbuild/buf-setup-action@a47c93e0b1648d5651a065437926377d060baa99 # v1.50.0
2024
# Perform breaking change detection against the `proto` directory in the `main` branch
21-
- uses: bufbuild/buf-breaking-action@v1
25+
- uses: bufbuild/buf-breaking-action@c57b3d842a5c3f3b454756ef65305a50a587c5ba # v1.1.4
2226
with:
2327
input: 'proto'
2428
against: 'https://github.com/grafana/grafana-plugin-sdk-go.git#branch=main,subdir=proto'

0 commit comments

Comments
 (0)