mirror of
https://github.com/immich-app/immich.git
synced 2026-03-26 11:50:53 +03:00
fix: track PR template auto-close with label (#27042)
* fix: track PR template auto-close with label * fix: format
This commit is contained in:
25
.github/workflows/check-pr-template.yml
vendored
25
.github/workflows/check-pr-template.yml
vendored
@@ -6,6 +6,9 @@ on:
|
|||||||
|
|
||||||
permissions: {}
|
permissions: {}
|
||||||
|
|
||||||
|
env:
|
||||||
|
LABEL_ID: 'LA_kwDOGyI-8M8AAAACcAeOfg' # auto-closed:template
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
parse:
|
parse:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -46,9 +49,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
gh api graphql \
|
gh api graphql \
|
||||||
-f prId="$NODE_ID" \
|
-f prId="$NODE_ID" \
|
||||||
|
-f labelId="$LABEL_ID" \
|
||||||
-f body="This PR has been automatically closed as the description doesn't follow our template. After you edit it to match the template, the PR will automatically be reopened." \
|
-f body="This PR has been automatically closed as the description doesn't follow our template. After you edit it to match the template, the PR will automatically be reopened." \
|
||||||
-f query='
|
-f query='
|
||||||
mutation CommentAndClosePR($prId: ID!, $body: String!) {
|
mutation CommentAndClosePR($prId: ID!, $body: String!, $labelId: ID!) {
|
||||||
addComment(input: {
|
addComment(input: {
|
||||||
subjectId: $prId,
|
subjectId: $prId,
|
||||||
body: $body
|
body: $body
|
||||||
@@ -60,21 +64,34 @@ jobs:
|
|||||||
}) {
|
}) {
|
||||||
__typename
|
__typename
|
||||||
}
|
}
|
||||||
|
addLabelsToLabelable(input: {
|
||||||
|
labelableId: $prId,
|
||||||
|
labelIds: [$labelId]
|
||||||
|
}) {
|
||||||
|
__typename
|
||||||
|
}
|
||||||
}'
|
}'
|
||||||
|
|
||||||
- name: Reopen PR (sections now present, PR closed)
|
- name: Reopen PR (sections now present, PR was auto-closed)
|
||||||
if: ${{ needs.parse.outputs.uses_template == 'true' && github.event.pull_request.state == 'closed' }}
|
if: ${{ needs.parse.outputs.uses_template == 'true' && github.event.pull_request.state == 'closed' && contains(github.event.pull_request.labels.*.node_id, env.LABEL_ID) }}
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
NODE_ID: ${{ github.event.pull_request.node_id }}
|
NODE_ID: ${{ github.event.pull_request.node_id }}
|
||||||
run: |
|
run: |
|
||||||
gh api graphql \
|
gh api graphql \
|
||||||
-f prId="$NODE_ID" \
|
-f prId="$NODE_ID" \
|
||||||
|
-f labelId="$LABEL_ID" \
|
||||||
-f query='
|
-f query='
|
||||||
mutation ReopenPR($prId: ID!) {
|
mutation ReopenPR($prId: ID!, $labelId: ID!) {
|
||||||
reopenPullRequest(input: {
|
reopenPullRequest(input: {
|
||||||
pullRequestId: $prId
|
pullRequestId: $prId
|
||||||
}) {
|
}) {
|
||||||
__typename
|
__typename
|
||||||
}
|
}
|
||||||
|
removeLabelsFromLabelable(input: {
|
||||||
|
labelableId: $prId,
|
||||||
|
labelIds: [$labelId]
|
||||||
|
}) {
|
||||||
|
__typename
|
||||||
|
}
|
||||||
}'
|
}'
|
||||||
|
|||||||
Reference in New Issue
Block a user