Skip to content

Fix bug with permissions in update changelog scripts #15085

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

Merged
merged 8 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/update_changelog/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ runs:
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git config --local github.token ${{ env.YDBOT_TOKEN }}
git config --local github.token ${{ env.GH_TOKEN }}
python ${{ github.action_path }}/update_changelog.py pr_data.txt "${{ inputs.changelog_path }}" "${{ inputs.base_branch }}" "${{ inputs.suffix }}"
6 changes: 3 additions & 3 deletions .github/actions/update_changelog/update_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
CATEGORY_PREFIX = "### "
ITEM_PREFIX = "* "

YDBOT_TOKEN = os.getenv("YDBOT_TOKEN")
GH_TOKEN = os.getenv("GH_TOKEN")

@functools.cache
def get_github_api_url():
Expand Down Expand Up @@ -152,7 +152,7 @@ def fetch_pr_details(pr_id):
url = f"https://api.github.com/repos/{get_github_api_url()}/pulls/{pr_id}"
headers = {
"Accept": "application/vnd.github.v3+json",
"Authorization": f"token {YDBOT_TOKEN}"
"Authorization": f"token {GH_TOKEN}"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
Expand All @@ -162,7 +162,7 @@ def fetch_user_details(username):
url = f"https://api.github.com/users/{username}"
headers = {
"Accept": "application/vnd.github.v3+json",
"Authorization": f"token {YDBOT_TOKEN}"
"Authorization": f"token {GH_TOKEN}"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/update_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ jobs:
TYPE="${{ github.event.inputs.type }}"
START="${{ github.event.inputs.start }}"
BRANCH="${GITHUB_REF_NAME}"

echo "::notice:: branch = ${GITHUB_REF_NAME}, start = $START"

if [ "$TYPE" == "date" ]; then
Expand Down Expand Up @@ -86,7 +85,7 @@ jobs:
- name: Update Changelog
uses: ./.github/actions/update_changelog
env:
YDBOT_TOKEN: ${{ secrets.YDBOT_TOKEN }}
GH_TOKEN: ${{ secrets.YDBOT_TOKEN }}
with:
pr_data: "${{ needs.gather-prs.outputs.prs }}"
changelog_path: "${{ github.event.inputs.changelog_path }}"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/weekly_update_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
- cron: '0 0 * * 0' # Every Sunday at 00:00
branches:
- main
- stable-*
workflow_dispatch:
env:
GH_TOKEN: ${{ secrets.YDBOT_TOKEN }}
Expand Down Expand Up @@ -62,7 +63,7 @@ jobs:
- name: Update Changelog
uses: ./.github/actions/update_changelog
env:
YDBOT_TOKEN: ${{ secrets.YDBOT_TOKEN }}
GH_TOKEN: ${{ secrets.YDBOT_TOKEN }}
with:
pr_data: "${{ needs.gather-prs.outputs.prs }}"
changelog_path: "./CHANGELOG.md" # RODO: Use the correct path to your CHANGELOG.md file
Expand Down
Loading