Skip to content

Commit f647760

Browse files
authored
Cleanup github actions files (#141)
1 parent 275caf1 commit f647760

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

.github/workflows/issue_commands.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
types: [labeled, unlabeled]
55
jobs:
66
main:
7+
permissions:
8+
contents: read
9+
issues: write
710
runs-on: ubuntu-latest
811
steps:
912
- name: Checkout Actions
@@ -12,6 +15,7 @@ jobs:
1215
repository: 'grafana/grafana-github-actions'
1316
path: ./actions
1417
ref: main
18+
persist-credentials: false
1519
- name: Install Actions
1620
run: npm install --production --prefix ./actions
1721
- name: 'Generate token'

.github/workflows/pr-commands.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ concurrency:
88
group: pr-commands-${{ github.event.number }}
99
jobs:
1010
main:
11+
permissions:
12+
contents: read
13+
pull-requests: write
1114
runs-on: ubuntu-latest
1215
steps:
1316
- name: Checkout Actions
@@ -16,6 +19,7 @@ jobs:
1619
repository: 'grafana/grafana-github-actions'
1720
path: ./actions
1821
ref: main
22+
persist-credentials: false
1923
- name: Install Actions
2024
run: npm install --production --prefix ./actions
2125
- name: 'Generate token'

.github/workflows/publish-npm.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ on:
44
branches:
55
- main
66

7+
permissions: {}
8+
79
jobs:
810
npm-publish:
911
name: Publish to NPM & GitHub Package Registry
1012
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
1116
outputs:
1217
new_version: ${{ steps.version_check.outputs.version }}
1318
version_changed: ${{ steps.version_check.outputs.changed }}
@@ -16,17 +21,21 @@ jobs:
1621
uses: actions/checkout@v4
1722
with:
1823
ref: main
24+
persist-credentials: false
1925
# limit releases to version changes - https://github.com/EndBug/version-check
2026
- name: Check version changes
21-
uses: EndBug/version-check@v2
27+
uses: EndBug/version-check@36ff30f37c7deabe56a30caa043d127be658c425 # v2.1.5
2228
id: version_check
2329
with:
2430
file-url: https://unpkg.com/@grafana/aws-sdk@latest/package.json
2531
static-checking: localIsNew
2632

2733
- name: Version update detected
34+
env:
35+
VERSION: ${{ steps.version_check.outputs.version }}
36+
TYPE: ${{ steps.version_check.outputs.type }}
2837
if: steps.version_check.outputs.changed == 'true'
29-
run: 'echo "Version change found! New version: ${{ steps.version_check.outputs.version }} (${{ steps.version_check.outputs.type }})"'
38+
run: 'echo "Version change found! New version: ${VERSION} (${TYPE})"'
3039

3140
- name: Setup .npmrc file for NPM registry
3241
if: steps.version_check.outputs.changed == 'true'
@@ -67,16 +76,23 @@ jobs:
6776
runs-on: ubuntu-latest
6877
needs: npm-publish
6978
if: needs.npm-publish.outputs.version_changed == 'true'
79+
permissions:
80+
contents: write
7081
steps:
7182
- name: Checkout code
7283
uses: actions/checkout@v4
84+
with:
85+
persist-credentials: false
7386

7487
- name: Create Release Notes
7588
uses: actions/[email protected]
89+
env:
90+
TAG_NAME: "v${{ needs.npm-publish.outputs.new_version }}"
7691
with:
7792
github-token: ${{ secrets.GITHUB_TOKEN }}
7893
script: |
94+
const { TAG_NAME } = process.env
7995
await github.request(`POST /repos/${{ github.repository }}/releases`, {
80-
tag_name: "v${{ needs.npm-publish.outputs.new_version }}",
96+
tag_name: `${TAG_NAME}`,
8197
generate_release_notes: true
8298
});

0 commit comments

Comments
 (0)