Skip to content

Commit c9dfb48

Browse files
committed
refactor: update release-drafter.yml for improved permissions and formatting
1 parent 0f37720 commit c9dfb48

File tree

1 file changed

+42
-34
lines changed

1 file changed

+42
-34
lines changed

.github/workflows/release-drafter.yml

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,36 @@ on:
77
- main
88
workflow_dispatch:
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
changes:
1215
runs-on: ubuntu-latest
1316
permissions:
17+
contents: read
1418
pull-requests: read
1519
steps:
16-
- name: Checkout repository
17-
uses: actions/checkout@v6
20+
- name: Checkout repository
21+
uses: actions/checkout@v6
1822

19-
- name: Generate filters
20-
id: filter-setup
21-
run: |
22-
# Add filter for core package (root directory files)
23-
filters="core: [\"*.go\", \"*.md\", \"go.mod\", \"go.sum\"]"
24-
filters+=$'\n'
25-
# Add filters for subdirectories
26-
filters+=$(find . -maxdepth 1 -type d ! -path ./.git ! -path . -exec basename {} \; | grep -v '^\.' | awk '{printf "%s: \"%s/**\"\n", $1, $1}')
27-
echo "filters<<EOF" >> $GITHUB_OUTPUT
28-
echo "$filters" >> $GITHUB_OUTPUT
29-
echo "EOF" >> $GITHUB_OUTPUT
30-
shell: bash
31-
- name: Filter changes
32-
id: filter
33-
uses: dorny/paths-filter@v3
34-
with:
35-
filters: ${{ steps.filter-setup.outputs.filters }}
23+
- name: Generate filters
24+
id: filter-setup
25+
run: |
26+
# Add filter for core package (root directory files)
27+
filters="core: [\"*.go\", \"*.md\", \"go.mod\", \"go.sum\"]"
28+
filters+=$'\n'
29+
# Add filters for subdirectories
30+
filters+=$(find . -maxdepth 1 -type d ! -path ./.git ! -path . -exec basename {} \; | grep -v '^\.' | awk '{printf "%s: \"%s/**\"\n", $1, $1}')
31+
echo "filters<<EOF" >> $GITHUB_OUTPUT
32+
echo "$filters" >> $GITHUB_OUTPUT
33+
echo "EOF" >> $GITHUB_OUTPUT
34+
shell: bash
35+
- name: Filter changes
36+
id: filter
37+
uses: dorny/paths-filter@v3
38+
with:
39+
filters: ${{ steps.filter-setup.outputs.filters }}
3640

3741
outputs:
3842
packages: ${{ steps.filter.outputs.changes || '[]' }}
@@ -41,26 +45,30 @@ jobs:
4145
needs: changes
4246
runs-on: ubuntu-latest
4347
timeout-minutes: 30
44-
if: needs.changes.outputs.packages != '[]' # Ensure job runs only if there are changes
48+
if: needs.changes.outputs.packages != '[]'
49+
permissions:
50+
contents: write
51+
pull-requests: read
4552
env:
4653
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4754
strategy:
4855
matrix:
4956
package: ${{ fromJSON(needs.changes.outputs.packages || '[]') }}
5057
steps:
51-
- name: Checkout repository
52-
uses: actions/checkout@v6
58+
- name: Checkout repository
59+
uses: actions/checkout@v6
5360

54-
- name: Generate dynamic config from template
55-
id: generate-config
56-
run: |
57-
folder="${{ matrix.package }}"
58-
sed "s|{{FOLDER}}|$folder|g" .github/release-drafter-template.yml > .github/release-drafter-$folder.yml
59-
echo "config<<EOF" >> $GITHUB_OUTPUT
60-
cat .github/release-drafter-$folder.yml >> $GITHUB_OUTPUT
61-
echo "EOF" >> $GITHUB_OUTPUT
61+
- name: Generate dynamic config from template
62+
id: generate-config
63+
run: |
64+
folder="${{ matrix.package }}"
65+
sed "s|{{FOLDER}}|$folder|g" .github/release-drafter-template.yml > .github/release-drafter-$folder.yml
66+
echo "config<<EOF" >> $GITHUB_OUTPUT
67+
cat .github/release-drafter-$folder.yml >> $GITHUB_OUTPUT
68+
echo "EOF" >> $GITHUB_OUTPUT
6269
63-
- name: Use dynamic release-drafter configuration
64-
uses: ReneWerner87/release-drafter@6dec4ceb1fb86b6514f11a2e7a39e1dedce709d0
65-
with:
66-
config: ${{ steps.generate-config.outputs.config }}
70+
- name: Use dynamic release-drafter configuration
71+
uses: ReneWerner87/release-drafter@1e213032283aaa6d64a8df087c4587a2ff531582
72+
with:
73+
config: ${{ steps.generate-config.outputs.config }}
74+
disable-autolabeler: true

0 commit comments

Comments
 (0)