Skip to content

Commit

Permalink
Merge branch 'hotfix-petrzpav' into prod-0
Browse files Browse the repository at this point in the history
  • Loading branch information
petrzpav committed Dec 7, 2023
2 parents 96222a1 + 7d9e06a commit 63d59e8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.5.7] - 2023-12-07

### Fixed

- Always create submit token.

## [0.5.6] - 2023-12-07

### Fixed
Expand Down Expand Up @@ -73,6 +79,7 @@ _Stable release based on [0.5.0-rc.1]._
- Set name of distributed project as `original_project_name user_name`


[0.5.7]: https://https://github.com/internetguru/academy/compare/v0.5.6...v0.5.7
[0.5.6]: https://https://github.com/internetguru/academy/compare/v0.5.5...v0.5.6
[0.5.5]: https://https://github.com/internetguru/academy/compare/v0.5.4...v0.5.5
[0.5.4]: https://https://github.com/internetguru/academy/compare/v0.5.3...v0.5.4
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.6
0.5.7
1 change: 1 addition & 0 deletions distribute
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ process_users() {
|| continue
project_id="$(get_project_id "${user_project_ns}")" \
|| continue
create_project_submit_token
user_id="$(get_user_id)"
add_member
[[ "$status_empty_code" == 0 ]] \
Expand Down
6 changes: 5 additions & 1 deletion gitlab_api
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,11 @@ fork_project() {
create_project_submit_token() {
local token
local output
output="$(gitlab_api "api/v4/projects/${project_id}/access_tokens" "{ \"name\":\"ACADEMY_SUBMIT_TOKEN\", \"scopes\":[\"write_repository\"], \"access_level\": 40 }")" \
# remove current access token and variable regardless of existence
gitlab_api "api/v4/projects/${project_id}/access_tokens/ACADEMY_SUBMIT_TOKEN" '-' > /dev/null 2>&1
gitlab_api "api/v4/projects/${project_id}/variables/ACADEMY_SUBMIT_TOKEN" '-' > /dev/null 2>&1
# create new access token and variable
output="$(gitlab_api "api/v4/projects/${project_id}/access_tokens" "{ \"name\":\"ACADEMY_SUBMIT_TOKEN\", \"scopes\":[\"write_repository\"], \"access_level\": 40, \"expires_at\": \"$(date +%Y-%m-%d -d "+ 356 day")\" }")" \
|| return 1
token="$(jq -r .token <<< "${output}")"
gitlab_api "api/v4/projects/${project_id}/variables" "POST-FORM:key=ACADEMY_SUBMIT_TOKEN&value=${token}&protected=true&masked=true" > /dev/null
Expand Down

0 comments on commit 63d59e8

Please sign in to comment.