vc-command #958
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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. |