Skip to content

Commit 3a26eee

Browse files
galnatblinkov
authored andcommitted
KiKIMR-22458 fix permissions in update changelog workflow (#14886)
1 parent 6cad9bc commit 3a26eee

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
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.UPDATE_REPO_TOKEN }}
43+
git config --local github.token ${{ env.YDBOT_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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
CATEGORY_PREFIX = "### "
1616
ITEM_PREFIX = "* "
1717

18+
YDBOT_TOKEN = os.getenv("YDBOT_TOKEN")
19+
1820
@functools.cache
1921
def get_github_api_url():
2022
return os.getenv('GITHUB_REPOSITORY')
@@ -150,7 +152,7 @@ def fetch_pr_details(pr_id):
150152
url = f"https://api.github.com/repos/{get_github_api_url()}/pulls/{pr_id}"
151153
headers = {
152154
"Accept": "application/vnd.github.v3+json",
153-
"Authorization": f"token {GITHUB_TOKEN}"
155+
"Authorization": f"token {YDBOT_TOKEN}"
154156
}
155157
response = requests.get(url, headers=headers)
156158
response.raise_for_status()
@@ -160,7 +162,7 @@ def fetch_user_details(username):
160162
url = f"https://api.github.com/users/{username}"
161163
headers = {
162164
"Accept": "application/vnd.github.v3+json",
163-
"Authorization": f"token {GITHUB_TOKEN}"
165+
"Authorization": f"token {YDBOT_TOKEN}"
164166
}
165167
response = requests.get(url, headers=headers)
166168
response.raise_for_status()
@@ -175,8 +177,6 @@ def fetch_user_details(username):
175177
changelog_path = sys.argv[2]
176178
base_branch = sys.argv[3]
177179
suffix = sys.argv[4]
178-
179-
GITHUB_TOKEN = os.getenv("UPDATE_REPO_TOKEN")
180180

181181
try:
182182
with open(pr_data_file, 'r') as file:

.github/workflows/update_changelog.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on:
2222
default: "changelog-for-"
2323

2424
env:
25-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
GH_TOKEN: ${{ secrets.YDBOT_TOKEN }}
2626

2727
jobs:
2828
gather-prs:
@@ -86,7 +86,7 @@ jobs:
8686
- name: Update Changelog
8787
uses: ./.github/actions/update_changelog
8888
env:
89-
UPDATE_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
YDBOT_TOKEN: ${{ secrets.YDBOT_TOKEN }}
9090
with:
9191
pr_data: "${{ needs.gather-prs.outputs.prs }}"
9292
changelog_path: "${{ github.event.inputs.changelog_path }}"

.github/workflows/weekly_update_changelog.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ on:
55
- cron: '0 0 * * 0' # Every Sunday at 00:00
66
branches:
77
- main
8-
- stable-*
98
workflow_dispatch:
109
env:
11-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10+
GH_TOKEN: ${{ secrets.YDBOT_TOKEN }}
1211

1312
jobs:
1413
gather-prs:
@@ -63,7 +62,7 @@ jobs:
6362
- name: Update Changelog
6463
uses: ./.github/actions/update_changelog
6564
env:
66-
UPDATE_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
YDBOT_TOKEN: ${{ secrets.YDBOT_TOKEN }}
6766
with:
6867
pr_data: "${{ needs.gather-prs.outputs.prs }}"
6968
changelog_path: "./CHANGELOG.md" # RODO: Use the correct path to your CHANGELOG.md file

0 commit comments

Comments
 (0)