mirror of
https://github.com/ivuorinen/actions.git
synced 2026-03-07 15:56:27 +00:00
Set `permissions: {}` at the top level of all workflow files to deny all
permissions by default, then grant only the minimum required permissions at
the job level. This fixes the Docker push failure caused by missing
`packages: write` permission being scoped incorrectly.
Changes per workflow:
- build-testing-image.yml: add contents: read + packages: write to job
- action-security.yml: consolidate contents: read, actions: read,
pull-requests: read into the analyze job
- codeql-new.yml: add actions: read to the analyze job
- dependency-review.yml: add contents: read to the dependency-review job
- issue-stats.yml: top-level only (no checkout, existing job perms sufficient)
- new-release.yml: was read-all; job already has contents: write
- pr-lint.yml: was contents: read + packages: read; job already has full perms
- release.yml: job already has contents: write
- security-suite.yml: move all perms to job level
- stale.yml: top-level only (no checkout, existing job perms sufficient)
- sync-labels.yml: was read-all; add contents: read to job for checkout
- version-maintenance.yml: move all perms to job level
Co-authored-by: ivuorinen <11024+ivuorinen@users.noreply.github.com>
43 lines
1.3 KiB
YAML
43 lines
1.3 KiB
YAML
---
|
|
name: Monthly issue metrics
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: '3 2 1 * *'
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
build:
|
|
name: issue metrics
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
issues: write
|
|
pull-requests: read
|
|
steps:
|
|
- name: Get dates for last month
|
|
shell: sh
|
|
run: |
|
|
# Calculate the first day of the previous month
|
|
first_day=$(date -d "last month" +%Y-%m-01)
|
|
|
|
# Calculate the last day of the previous month
|
|
last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d)
|
|
|
|
#Set an environment variable with the date range
|
|
echo "$first_day..$last_day"
|
|
echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV"
|
|
|
|
- name: Run issue-metrics tool
|
|
uses: github/issue-metrics@41a7961f701cc64490f32e143af8ef479b93e87d # v4.1.0
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SEARCH_QUERY: 'repo:ivuorinen/actions is:issue created:${{ env.last_month }} -reason:"not planned"'
|
|
|
|
- name: Create issue
|
|
uses: peter-evans/create-issue-from-file@fca9117c27cdc29c6c4db3b86c48e4115a786710 # v6.0.0
|
|
with:
|
|
title: Monthly issue metrics report
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
content-filepath: ./issue_metrics.md
|