-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: update sync to pg workflow to use github pat for accessing the secrets #36944
Conversation
@@ -50,7 +50,7 @@ jobs: | |||
- name: Push changes | |||
if: env.MERGE_CONFLICT == 'false' | |||
run: | | |||
git push origin pg | |||
git push https://${{ secrets.PAT_GITHUB }}@github.com/${{ github.repository }} HEAD:pg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is PAT_GITHUB
? I can't see this in secrets may be you are looking at EE repo where this is present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, it must be present in EE only. We have this for sync workflow between ce and ee already. I am using the same well.
This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected. |
This PR has been closed because of inactivity. |
This PR has been closed because of inactivity. |
…o chore/sync-release-pg-workflow
WalkthroughThe changes made in the pull request focus on updating the GitHub Actions workflow file Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (1)
.github/workflows/sync-release-to-pg.yml (1)
Add required workflow permissions to enhance security
The workflow performs git operations and uses secrets but lacks explicit permissions declaration. Add these permissions to follow security best practices:
permissions: contents: write # For git operations actions: read # For workflow execution security-events: none
- The workflow uses
secrets.PAT_GITHUB
for pushing changes- Performs git operations (checkout, merge, push)
- Sends notifications to Slack
- Currently runs with implicit permissions which is less secure
🔗 Analysis chain
Line range hint
1-24
: Verify workflow permissionsThe workflow handles sensitive operations like branch merging and uses secrets. Consider explicitly declaring required permissions:
Add these permission declarations at the start of the workflow:
name: Merge release to pg on: push: branches: - release +permissions: + contents: write # Required for git push + actions: read # Required for workflow + security-events: none jobs: merge-release-to-pg: runs-on: ubuntu-latestLet's verify the current permissions:
Let me analyze the workflow permissions configuration by checking the current file and similar workflows. The previous GitHub API command failed as expected in the sandbox environment, so let's examine the files directly.
Let me analyze the complete workflow file and the context around permissions to provide accurate guidance. The previous results showed permissions declarations exist, but we need to see their specific settings.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check current workflow permissions gh api repos/${{ github.repository }}/actions/permissions | jq .Length of output: 123
Script:
#!/bin/bash # Check workflow permissions in the file rg -U "permissions:" .github/workflows/sync-release-to-pg.yml # Look for any other workflow files that might have similar merge operations fd -e yml -e yaml . .github/workflows/ --exec rg -U "permissions:" {} # Check if there are other similar workflows for comparison fd -e yml -e yaml . .github/workflows/ --exec rg -U "merge.*to.*pg" {}Length of output: 425
Script:
#!/bin/bash # Get more context around the permissions declarations rg -B 2 -A 4 "permissions:" .github/workflows/sync-release-to-pg.yml # Check the complete workflow file to understand the operations cat .github/workflows/sync-release-to-pg.ymlLength of output: 4097
🧰 Tools
🪛 actionlint
52-52: shellcheck reported issue in this script: SC2086:info:2:119: Double quote to prevent globbing and word splitting
(shellcheck)
58-58: shellcheck reported issue in this script: SC2086:info:3:50: Double quote to prevent globbing and word splitting
(shellcheck)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/sync-release-to-pg.yml
(1 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/sync-release-to-pg.yml
58-58: shellcheck reported issue in this script: SC2086:info:3:50: Double quote to prevent globbing and word splitting
(shellcheck)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the bot review else LGTM.
Description
In order to modify a workflow, a GitHub App, such as the one used for issuing tokens for GitHub Actions, requires the workflow scope. This is so that GitHub Apps you've added to your repository can't access the secrets in your repository without your permission. The token issued for GitHub Actions doesn't have this permission by default.
This PR adds pat token to the push command. This is to avoid failures when the secrets are modified in the repositories.
Automation
/ok-to-test tags=""
🔍 Cypress test results
Warning
Tests have not run on the HEAD b09d354 yet
Wed, 13 Nov 2024 06:09:54 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
release
branch into thepg
branch to use a personal access token for enhanced security.