Skip to content

Commit 6c60d46

Browse files
galnatnaspirato
andauthored
Fix bug with permissions in update changelog scripts (#15085)
Co-authored-by: Kirill Rysin <[email protected]>
1 parent 9ac8b04 commit 6c60d46

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

.github/actions/update_changelog/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ runs:
4040
run: |
4141
git config --local user.email "[email protected]"
4242
git config --local user.name "GitHub Action"
43-
git config --local github.token ${{ env.YDBOT_TOKEN }}
43+
git config --local github.token ${{ env.GH_TOKEN }}
4444
python ${{ github.action_path }}/update_changelog.py pr_data.txt "${{ inputs.changelog_path }}" "${{ inputs.base_branch }}" "${{ inputs.suffix }}"

.github/actions/update_changelog/update_changelog.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
CATEGORY_PREFIX = "### "
1616
ITEM_PREFIX = "* "
1717

18-
YDBOT_TOKEN = os.getenv("YDBOT_TOKEN")
18+
GH_TOKEN = os.getenv("GH_TOKEN")
1919

2020
@functools.cache
2121
def get_github_api_url():
@@ -152,7 +152,7 @@ def fetch_pr_details(pr_id):
152152
url = f"https://api.github.com/repos/{get_github_api_url()}/pulls/{pr_id}"
153153
headers = {
154154
"Accept": "application/vnd.github.v3+json",
155-
"Authorization": f"token {YDBOT_TOKEN}"
155+
"Authorization": f"token {GH_TOKEN}"
156156
}
157157
response = requests.get(url, headers=headers)
158158
response.raise_for_status()
@@ -162,7 +162,7 @@ def fetch_user_details(username):
162162
url = f"https://api.github.com/users/{username}"
163163
headers = {
164164
"Accept": "application/vnd.github.v3+json",
165-
"Authorization": f"token {YDBOT_TOKEN}"
165+
"Authorization": f"token {GH_TOKEN}"
166166
}
167167
response = requests.get(url, headers=headers)
168168
response.raise_for_status()

.github/workflows/update_changelog.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
TYPE="${{ github.event.inputs.type }}"
4040
START="${{ github.event.inputs.start }}"
4141
BRANCH="${GITHUB_REF_NAME}"
42-
4342
echo "::notice:: branch = ${GITHUB_REF_NAME}, start = $START"
4443
4544
if [ "$TYPE" == "date" ]; then
@@ -86,7 +85,7 @@ jobs:
8685
- name: Update Changelog
8786
uses: ./.github/actions/update_changelog
8887
env:
89-
YDBOT_TOKEN: ${{ secrets.YDBOT_TOKEN }}
88+
GH_TOKEN: ${{ secrets.YDBOT_TOKEN }}
9089
with:
9190
pr_data: "${{ needs.gather-prs.outputs.prs }}"
9291
changelog_path: "${{ github.event.inputs.changelog_path }}"

.github/workflows/weekly_update_changelog.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
- cron: '0 0 * * 0' # Every Sunday at 00:00
66
branches:
77
- main
8+
- stable-*
89
workflow_dispatch:
910
env:
1011
GH_TOKEN: ${{ secrets.YDBOT_TOKEN }}
@@ -62,7 +63,7 @@ jobs:
6263
- name: Update Changelog
6364
uses: ./.github/actions/update_changelog
6465
env:
65-
YDBOT_TOKEN: ${{ secrets.YDBOT_TOKEN }}
66+
GH_TOKEN: ${{ secrets.YDBOT_TOKEN }}
6667
with:
6768
pr_data: "${{ needs.gather-prs.outputs.prs }}"
6869
changelog_path: "./CHANGELOG.md" # RODO: Use the correct path to your CHANGELOG.md file

0 commit comments

Comments
 (0)