2023-07-26 08:57:08 +00:00
|
|
|
# Rename transifex pull requests to have a correct naming
|
2023-08-31 13:18:15 +00:00
|
|
|
# Also enables auto squash-merge
|
2023-07-26 08:57:08 +00:00
|
|
|
name: authentik-translation-transifex-rename
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [opened, reopened]
|
|
|
|
|
2023-11-18 00:55:48 +00:00
|
|
|
permissions:
|
|
|
|
# Permission to rename PR
|
|
|
|
pull-requests: write
|
|
|
|
|
2023-07-26 08:57:08 +00:00
|
|
|
jobs:
|
|
|
|
rename_pr:
|
|
|
|
runs-on: ubuntu-latest
|
2023-07-26 09:01:57 +00:00
|
|
|
if: ${{ github.event.pull_request.user.login == 'transifex-integration[bot]'}}
|
2023-07-26 08:57:08 +00:00
|
|
|
steps:
|
|
|
|
- id: generate_token
|
2023-09-11 10:27:07 +00:00
|
|
|
uses: tibdex/github-app-token@v2
|
2023-07-26 08:57:08 +00:00
|
|
|
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 }}\"}"
|
2023-08-31 13:18:15 +00:00
|
|
|
- uses: peter-evans/enable-pull-request-automerge@v3
|
|
|
|
with:
|
|
|
|
token: ${{ steps.generate_token.outputs.token }}
|
|
|
|
pull-request-number: ${{ github.event.pull_request.number }}
|
|
|
|
merge-method: squash
|