-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33634d9
commit f9101f7
Showing
1 changed file
with
0 additions
and
58 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,61 +19,3 @@ jobs: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
configuration-path: .github/labeler.yml | ||
sync-labels: true | ||
|
||
update-pr-title: | ||
runs-on: ubuntu-latest | ||
needs: set-labels | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get PR Info | ||
id: get_pr | ||
uses: octokit/[email protected] | ||
with: | ||
route: GET /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract Labels | ||
id: extract_labels | ||
run: echo "::set-output name=labels::${{ toJSON(github.event.pull_request.labels.*.name) }}" | ||
|
||
- name: Update PR Title | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
PR_TITLE=$(jq -r '.title' <<< "${{ steps.get_pr.outputs.data }}") | ||
PR_LABELS="${{ steps.extract_labels.outputs.labels }}" | ||
PREFIX="" | ||
if [[ "$PR_LABELS" == *"Documentation"* ]]; then | ||
PREFIX="[Docs]" | ||
elif [[ "$PR_LABELS" == *"NuGet"* ]]; then | ||
PREFIX="[NuGet]" | ||
elif [[ "$PR_LABELS" == *"Scripts"* ]]; then | ||
PREFIX="[Scripts]" | ||
elif [[ "$PR_LABELS" == *"regarding-events"* ]]; then | ||
PREFIX="[Events]" | ||
elif [[ "$PR_LABELS" == *"regarding-api"* ]]; then | ||
PREFIX="[API]" | ||
elif [[ "$PR_LABELS" == *"regarding-transpiler"* ]]; then | ||
PREFIX="[Transpiler]" | ||
elif [[ "$PR_LABELS" == *"CustomModules"* ]]; then | ||
PREFIX="[CustomModules]" | ||
elif [[ "$PR_LABELS" == *"Installer"* ]]; then | ||
PREFIX="[Installer]" | ||
elif [[ "$PR_LABELS" == *"GitHub_Actions"* ]]; then | ||
PREFIX="[GitHub]" | ||
fi | ||
NEW_TITLE="$PREFIX $PR_TITLE" | ||
if [[ "$NEW_TITLE" != "$PR_TITLE" ]]; then | ||
curl -X PATCH \ | ||
-H "Authorization: token $GITHUB_TOKEN" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} \ | ||
-d "{\"title\":\"$NEW_TITLE\"}" | ||
fi |