Skip to content

Commit a988643

Browse files
committed
security: do not upload git config to build archive
1 parent fb31f5e commit a988643

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v4
1414

1515
- name: Cache Composer dependencies
16-
uses: actions/cache@v3
16+
uses: actions/cache@v4
1717
with:
1818
path: /tmp/composer-cache
1919
key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
@@ -24,7 +24,7 @@ jobs:
2424
php_version: ${{ matrix.php }}
2525

2626
- name: Archive build
27-
run: mkdir /tmp/github-actions/ && tar -cvf /tmp/github-actions/build.tar ./
27+
run: mkdir /tmp/github-actions/ && tar --exclude=".git" -cvf /tmp/github-actions/build.tar ./
2828

2929
- name: Upload build archive for test runners
3030
uses: actions/upload-artifact@v4
@@ -158,3 +158,21 @@ jobs:
158158
php_version: ${{ matrix.php }}
159159
path: src/
160160
standard: phpcs.xml
161+
162+
remove_old_artifacts:
163+
runs-on: ubuntu-latest
164+
165+
permissions:
166+
actions: write
167+
168+
steps:
169+
- name: Remove old artifacts for prior workflow runs on this repository
170+
env:
171+
GH_TOKEN: ${{ github.token }}
172+
run: |
173+
gh api "/repos/${{ github.repository }}/actions/artifacts" | jq ".artifacts[] | select(.name | startswith(\"build-artifact\")) | .id" > artifact-id-list.txt
174+
while read id
175+
do
176+
echo -n "Deleting artifact ID $id ... "
177+
gh api --method DELETE /repos/${{ github.repository }}/actions/artifacts/$id && echo "Done"
178+
done <artifact-id-list.txt

composer.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)