Skip to content

Commit

Permalink
Add pull-requests read permission to the release-notes-check workflow (
Browse files Browse the repository at this point in the history
…frequenz-floss#289)

This is necessary when the repository Actions configuration is set up
without full access by default. In this case, the only access provided
is `contents: read`, but this action needs to read the pull request too.
  • Loading branch information
llucax authored Jul 10, 2024
2 parents 6aa6bc0 + 1778ff8 commit bfd45a8
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release-notes-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
check-release-notes:
name: Check release notes are updated
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- name: Check for a release notes update
if: github.event_name == 'pull_request'
Expand Down
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ This release includes quite a few enhancements and bug fixes for the cookiecutte
- Fix credentials not being passed to the `test-installation` job in the CI workflow.
- Make sure credentials are configured for all jobs that check out the repository in the CI workflow.
- Disable the new `check-class-attributes` check in pydoclint 0.5.3, as we use a different way to document class attributes.
- Fix permissions issues with the `release-notes-check` workflow when the repository Actions configuration is set up without full access.
19 changes: 19 additions & 0 deletions cookiecutter/migrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,24 @@ echo "========================================================================"
echo "Disabling new pydoclint's check-class-attributes check in "
sed -i "/^allow-init-docstring/a check-class-attributes = false" pyproject.toml

echo "========================================================================"

echo "Adding pull-requests read permission to the release-notes-check workflow"
patch --merge -p1 <<'EOF'
diff --git a/.github/workflows/release-notes-check.yml b/.github/workflows/release-notes-check.yml
index 1e35c1a..e97886b 100644
--- a/.github/workflows/release-notes-check.yml
+++ b/.github/workflows/release-notes-check.yml
@@ -17,6 +17,8 @@ jobs:
check-release-notes:
name: Check release notes are updated
runs-on: ubuntu-latest
+ permissions:
+ pull-requests: read
steps:
- name: Check for a release notes update
if: github.event_name == 'pull_request'
EOF

# Add a separation line like this one after each migration step.
echo "========================================================================"
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
check-release-notes:
name: Check release notes are updated
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- name: Check for a release notes update
if: github.event_name == 'pull_request'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
check-release-notes:
name: Check release notes are updated
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- name: Check for a release notes update
if: github.event_name == 'pull_request'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
check-release-notes:
name: Check release notes are updated
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- name: Check for a release notes update
if: github.event_name == 'pull_request'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
check-release-notes:
name: Check release notes are updated
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- name: Check for a release notes update
if: github.event_name == 'pull_request'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
check-release-notes:
name: Check release notes are updated
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- name: Check for a release notes update
if: github.event_name == 'pull_request'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
check-release-notes:
name: Check release notes are updated
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- name: Check for a release notes update
if: github.event_name == 'pull_request'
Expand Down

0 comments on commit bfd45a8

Please sign in to comment.