Skip to content

Commit

Permalink
Added permissions for GitHub workflow config (#6791)
Browse files Browse the repository at this point in the history
* Added permissions for GitHub workflow config

* Added a changelog entry

---------

Co-authored-by: Bryan Kendall <bkend@google.com>
  • Loading branch information
aalej and bkendall committed Feb 21, 2024
1 parent 9dc6d38 commit 38d119b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
that this is a preview feature and if you find any bugs, please file them
here: <https://github.com/firebase/firebase-tools/issues>.
- Improve FAH onboarding flow to connect backends with SCMs (#6764).
- Fixed issue where GitHub actions would fail due to lack of permission. (#6791)
6 changes: 6 additions & 0 deletions src/init/features/hosting/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ function mkdirNotExists(dir: string): void {
type GitHubWorkflowConfig = {
name: string;
on: string | { [key: string]: { [key: string]: string[] } };
permissions?: string | { [key: string]: string };
jobs: {
[key: string]: {
if?: string;
Expand All @@ -300,6 +301,11 @@ function writeChannelActionYMLFile(
const workflowConfig: GitHubWorkflowConfig = {
name: "Deploy to Firebase Hosting on PR",
on: "pull_request",
permissions: {
checks: "write",
contents: "read",
"pull-requests": "write",
},
jobs: {
["build_and_preview"]: {
if: "${{ github.event.pull_request.head.repo.full_name == github.repository }}", // secrets aren't accessible on PRs from forks
Expand Down

0 comments on commit 38d119b

Please sign in to comment.