Skip to content

Commit

Permalink
GH Infra: project automation and issue template fixes (#297)
Browse files Browse the repository at this point in the history
* Change from App auth to an org secret

* Fix labels in issue templates

* Revert app secret method, not the root cause

* Move draft conversion, exit if pull_request_review
  • Loading branch information
jarmak-nv authored Aug 16, 2023
1 parent e459eeb commit 380d381
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Bug Report
description: Create a report to help us improve
title: '[BUG]: '
labels: ['Bug']
labels: ['bug']
body:
- type: checkboxes
id: check-duplicates
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/doc_request.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Documentation Request
description: Suggest an idea to improve CCCL
title: '[DOC]: '
labels: ['Doc']
labels: ['doc']

body:
- type: checkboxes
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Feature Request
description: Suggest an idea to improve CCCL
title: '[FEA]: '
labels: ['Feature']
labels: ['feature request']
body:
- type: checkboxes
id: check-duplicates
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/project_automation_set_in_progress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ env:
jobs:
query_and_mutate_project_fields:
runs-on: ubuntu-latest

permissions:
issues: write
pull-requests: write

steps:
- name: Check if changes requested from a reviewer
Expand All @@ -51,8 +55,20 @@ jobs:
if [ ${{ github.event.review.state }} != 'changes_requested' ]; then
echo "Changes not requested, exiting"
exit 0
# If it is requesting changes, set PR to draft
# We use the default token here since we're granting write access to the PR
elif [ ${{ github.event.pull_request.draft }} == true ]; then
gh api graphql -f query='
mutation {
convertPullRequestToDraft(input: {pullRequestId: "${{ env.PR_GLOBAL_ID }}"}) {
clientMutationId
}
}'
exit 0
fi
fi
continue-on-error: true

- name: Generate token
id: generate_token
Expand Down Expand Up @@ -334,19 +350,3 @@ jobs:
fi
done
continue-on-error: true

- name: set PR to draft
id: set_pr_draft
# only run if PR is not a draft
if: ${{ github.event.pull_request.draft }} == false
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
# Set the PR to draft using the graphQL API
gh api graphql -f query='
mutation {
convertPullRequestToDraft(input: {pullRequestId: "${{ env.PR_GLOBAL_ID }}"}) {
clientMutationId
}
}'
continue-on-error: true

0 comments on commit 380d381

Please sign in to comment.