Skip to content

Commit 889aa86

Browse files
committed
create/update
1 parent 5b3de1d commit 889aa86

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

example/test.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,24 @@ def main():
1515
client_secret = private_key
1616
auth = githubapp.Auth(app_id, installation_id, client_secret)
1717
access_token = auth.get_access_token()
18-
print(access_token)
1918

2019
g = Github(access_token)
2120

2221
repo = g.get_repo("RTa-scp/reserveiframe")
2322
repocontent=[]
24-
contents = repo.get_contents("src/reserve")
23+
contents = repo.get_contents("src/reserve", ref="reserve")
2524
while contents:
2625
file_content = contents.pop(0)
2726
if file_content.type == "dir":
2827
contents.extend(repo.get_contents(file_content.path))
2928
else:
3029
repocontent.append(file_content.path)
31-
print(repocontent)
3230
file = "src/reserve/component/theme.md"
3331
if file in repocontent:
34-
contents = repo.get_contents(file, ref="main")
35-
repo.update_file(contents.path, "update: GithubApps", '---\nurl: content\nuser: user\nstarttime: "2022-04-10"\nendtime: "2022-07-10"\n---\n<reserve />', contents.sha, branch="main")
32+
contents = repo.get_contents(file, ref="reserve")
33+
repo.update_file(contents.path, "update: GithubApps", '---\nurl: content\nuser: user\nstarttime: "2022-04-10"\nendtime: "2022-07-10"\n---\n<reserve />', contents.sha, branch="reserve")
3634
else:
37-
repo.create_file(file, "create: GithubApps", '---\nurl: content\nuser: user\nstarttime: "2022-04-10"\nendtime: "2022-07-10"\n---\n<reserve />', branch="main")
38-
39-
# repo.create_file("src/reserve/test.md", "create: GithubApps", '---\nurl: content\nuser: user\nstarttime: "2022-03-10"\nendtime: "2022-06-10"\n---\n<reserve />', branch="main")
40-
# contents = repo.get_contents("src/reserve/test.md", ref="main")
41-
# repo.update_file(contents.path, "update: GithubApps", '---\nurl: content\nuser: user\nstarttime: "2022-04-10"\nendtime: "2022-07-10"\n---\n<reserve />', contents.sha, branch="main")
35+
repo.create_file(file, "create: GithubApps", '---\nurl: content\nuser: user\nstarttime: "2022-04-11"\nendtime: "2022-07-11"\n---\n<reserve />', branch="reserve")
4236

4337
if __name__ == "__main__":
4438
main()

0 commit comments

Comments
 (0)