mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-21 02:51:11 +00:00
* GitHub Workflows security hardening (#14799) * build: harden update_frontend.yml permissions Signed-off-by: Alex <aleksandrosansan@gmail.com> * build: harden update_zhc.yml permissions Signed-off-by: Alex <aleksandrosansan@gmail.com> * build: harden ghcr_cleanup.yml permissions Signed-off-by: Alex <aleksandrosansan@gmail.com> * build: harden update_zh.yml permissions Signed-off-by: Alex <aleksandrosansan@gmail.com> Signed-off-by: Alex <aleksandrosansan@gmail.com> * Add bound polling by manufacturerNames Based on: #7825 * Add bound polling by manufacturerNames Based on: #7825 Signed-off-by: Alex <aleksandrosansan@gmail.com> Co-authored-by: Alex <aleksandrosansan@gmail.com>
35 lines
1.1 KiB
YAML
35 lines
1.1 KiB
YAML
on:
|
|
workflow_dispatch:
|
|
|
|
name: GHCR cleanup
|
|
|
|
permissions: {}
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Delete untagged images
|
|
uses: actions/github-script@v6
|
|
with:
|
|
github-token: ${{ secrets.CR_PAT }}
|
|
script: |
|
|
const response = await github.request("GET /${{ env.OWNER }}/packages/container/${{ env.PACKAGE_NAME }}/versions",
|
|
{ per_page: ${{ env.PER_PAGE }}
|
|
});
|
|
for(version of response.data) {
|
|
if (version.metadata.container.tags.length == 0) {
|
|
try {
|
|
console.log("delete " + version.id)
|
|
const deleteResponse = await github.request("DELETE /${{ env.OWNER }}/packages/container/${{ env.PACKAGE_NAME }}/versions/" + version.id, { });
|
|
console.log("status " + deleteResponse.status)
|
|
} catch (e) {
|
|
console.log("failed")
|
|
}
|
|
}
|
|
}
|
|
env:
|
|
OWNER: user
|
|
PACKAGE_NAME: zigbee2mqtt
|
|
PER_PAGE: 2000
|