Skip to content
Snippets Groups Projects
Verified Commit 093e77a6 authored by Kristian Klausen's avatar Kristian Klausen :tada:
Browse files

Merge branch 'monthly-report-script' into 'main'

Add script and CI for automatic creation of monthly report issues

See merge request !1
parents 492d8c76 8d467d7a
Branches main
No related tags found
1 merge request!1Add script and CI for automatic creation of monthly report issues
Pipeline #121063 passed
* text=auto
monthly_report:
image: docker.io/archlinux/archlinux:latest
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
script:
- ./script.sh
stage: deploy
tags:
- secure
LICENSE 0 → 100644
MIT License
Copyright (c) 2024 Kristian Klausen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
#!/bin/bash
set -o nounset -o errexit -o pipefail
gitlab_api() {
curl -sSf \
--request "${1}" \
--header "PRIVATE-TOKEN: ${GITLAB_PROJECT_TOKEN}" \
"https://gitlab.archlinux.org/api/v4/${2}" "${@:3}"
}
create_issue() {
local project="${1}"
local title="${2}"
local description="${3}"
gitlab_api POST "projects/${project}/issues" --data-urlencode "title=${title}" --data-urlencode "description=$(echo -e "${description}")"
}
create_monthly_report_issue() {
local project month month_name year title description
project="archlinux%2Fproject-management"
month="$(date +%m)"
month_name="$(LC_ALL=C date +%B)"
year="$(date +%Y)"
title="Monthly Report for ${month_name} ${year}"
description="/label ~monthly-report\nPad for ${month_name} ${year}: https://md.archlinux.org/${year}-${month}_monthly-report"
create_issue "${project}" "${title}" "${description}"
}
create_monthly_report_issue
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment