This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/.github/workflows/translation-rename.yml
Jens Langhammer 47abbcf8b8
ci: test rename
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2023-07-26 10:59:59 +02:00

47 lines
1.6 KiB
YAML

# Rename transifex pull requests to have a correct naming
name: authentik-translation-transifex-rename
on:
pull_request:
types: [opened, reopened]
jobs:
debug:
runs-on: ubuntu-latest
steps:
- run: |
set -xe
echo "${{ github.event.sender.login }}"
echo "${{ github.event.sender }}"
rename_pr:
runs-on: ubuntu-latest
if: ${{ github.event.sender.login == 'transifex-integration[bot]'}}
steps:
- id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.GH_APP_ID }}
private_key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: Get current title
id: title
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
title=$(curl -q -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GH_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${{ github.event.pull_request.number }} | jq -r .title)
echo "title=${title}" >> "$GITHUB_OUTPUT"
- name: Rename
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GH_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${{ github.event.pull_request.number }} \
-d "{\"title\":\"translate: ${{ steps.title.outputs.title }}\"}"