Skip to content

Commit d35a063

Browse files
committed
ci: improve security of workflow
1 parent 162eeb5 commit d35a063

1 file changed

Lines changed: 5 additions & 18 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
push:
55
pull_request:
66

7+
permissions:
8+
contents: read
9+
actions: read
10+
711
jobs:
812
composer:
913
runs-on: ubuntu-latest
@@ -34,6 +38,7 @@ jobs:
3438
with:
3539
name: build-artifact-${{ matrix.php }}
3640
path: /tmp/github-actions
41+
retention-days: 1
3742

3843
# phpunit:
3944
# runs-on: ubuntu-latest
@@ -163,21 +168,3 @@ jobs:
163168
php_version: ${{ matrix.php }}
164169
path: src/
165170
standard: phpcs.xml
166-
167-
remove_old_artifacts:
168-
runs-on: ubuntu-latest
169-
170-
permissions:
171-
actions: write
172-
173-
steps:
174-
- name: Remove old artifacts for prior workflow runs on this repository
175-
env:
176-
GH_TOKEN: ${{ github.token }}
177-
run: |
178-
gh api "/repos/${{ github.repository }}/actions/artifacts" | jq ".artifacts[] | select(.name | startswith(\"build-artifact\")) | .id" > artifact-id-list.txt
179-
while read id
180-
do
181-
echo -n "Deleting artifact ID $id ... "
182-
gh api --method DELETE /repos/${{ github.repository }}/actions/artifacts/$id && echo "Done"
183-
done <artifact-id-list.txt

0 commit comments

Comments
 (0)