-
Notifications
You must be signed in to change notification settings - Fork 21
77 lines (66 loc) · 2.67 KB
/
vc-command.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
name: Changelog Command
on:
repository_dispatch:
types: [vc-command]
jobs:
append-changelog:
runs-on: ubuntu-latest
container: ghcr.io/dcermak/bci-ci:latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# ensure that we have write permissions for pushes
token: ${{ secrets.CHECKOUT_TOKEN }}
- uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: poetry-${{ hashFiles('poetry.lock') }}
- name: fix the file permissions of the repository
run: chown -R $(id -un):$(id -gn) .
- name: install python dependencies
run: poetry install
- name: Add the changelog entries
id: vars
run: |
# this returns SUSE:$branch_name
branch="${{ github.event.client_payload.pull_request.head.label }}"
if [[ -z "$branch" ]]; then echo "No branch set!"; exit 1; fi
# fail if the origin branch is wrong
[[ "$branch" =~ ^SUSE:for-deploy- ]]
export OS_VERSION="${branch/SUSE:for-deploy-/}"
entry="${{ github.event.client_payload.slash_command.args.unnamed.all }}"
if [[ -z "$entry" ]]; then echo "No changelog entry provided!"; exit 1; fi
export entry
PACKAGES="${{ github.event.client_payload.slash_command.args.named.packages }}"
if [[ -z "$PACKAGES" ]]; then
unset PACKAGES
else
export PACKAGES
fi
poetry run scratch-build-bot \
-vvvv --os-version $OS_VERSION \
add_changelog_entry \
"$entry"
env:
OSC_PASSWORD: ${{ secrets.OSC_PASSWORD }}
OSC_USER: "defolos"
- name: Add reaction to the original comment on success
if: ${{ success() }}
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.PAT }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reactions: "+1"
- name: generate the url to this workflow run
if: ${{ failure() || cancelled() }}
run: echo "run_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV
- name: Add reaction and a link to the error to the original comment on failure
if: ${{ failure() || cancelled() }}
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.PAT }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reactions: "-1"
body: Failed to update the changelog, see the [workflow run](${{ env.run_url }}) for further details.