generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1742 from hashicorp/introduce-labelers-workflow
Introduce labelers workflow
- Loading branch information
Showing
3 changed files
with
132 additions
and
37 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,132 @@ | ||
name: Label Automations | ||
|
||
permissions: | ||
issues: write | ||
pull-requests: write | ||
|
||
on: | ||
issues: | ||
types: | ||
- closed | ||
- edited | ||
- opened | ||
|
||
issue_comment: | ||
types: | ||
- created | ||
|
||
pull_request_target: | ||
types: | ||
- assigned | ||
- closed | ||
- edited | ||
- opened | ||
|
||
jobs: | ||
repo_and_community: | ||
name: Repository and Community Labels | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
GH_CLI_SUBCOMMAND: ${{ (github.event.issue.pull_request || github.event.pull_request) && 'pr' || 'issue' }} | ||
ISSUE_URL: ${{ github.event.issue.html_url || github.event.pull_request.html_url }} | ||
LABELS: ${{ toJSON(github.event.issue.labels.*.name || github.event.pull_request.labels.*.name) }} | ||
MAINTAINERS: ${{ secrets.MAINTAINERS }} | ||
|
||
steps: | ||
- name: "Community Check: Author" | ||
id: author | ||
if: github.event.action == 'opened' | ||
env: | ||
AUTHOR_LOGIN: ${{ github.event.issue.user.login || github.event.pull_request.user.login }} | ||
CORE_CONTRIBUTORS: ${{ secrets.CORE_CONTRIBUTORS }} | ||
PARTNERS: ${{ secrets.PARTNERS }} | ||
run: | | ||
echo "is_core_contributor=$(echo $CORE_CONTRIBUTORS | base64 --decode | jq --arg u $AUTHOR_LOGIN '. | contains([$u])')" >> "$GITHUB_OUTPUT" | ||
echo "is_maintainer=$(echo $MAINTAINERS | base64 --decode | jq --arg u $AUTHOR_LOGIN '. | contains([$u])')" >> "$GITHUB_OUTPUT" | ||
echo "is_partner=$(echo $PARTNERS | base64 --decode | jq --arg u $AUTHOR_LOGIN '. | contains([$u])')" >> "$GITHUB_OUTPUT" | ||
- name: Indicate That Triage is Required | ||
if: | | ||
steps.author.conclusion != 'skipped' | ||
&& !fromJSON(steps.author.outputs.is_maintainer) | ||
run: | | ||
gh $GH_CLI_SUBCOMMAND edit "$ISSUE_URL" --add-label needs-triage | ||
- name: Credit Core Contributor Contributions | ||
if: | | ||
github.event_name == 'pull_request_target' | ||
&& steps.author.conclusion != 'skipped' | ||
&& fromJSON(steps.author.outputs.is_core_contributor) | ||
run: | | ||
gh pr edit "$ISSUE_URL" --add-label external-maintainer | ||
- name: Add prioritized to Maintainer Contributions | ||
if: | | ||
github.event_name == 'pull_request_target' | ||
&& steps.author.conclusion != 'skipped' | ||
&& fromJSON(steps.author.outputs.is_maintainer)) | ||
run: | | ||
gh pr edit "$ISSUE_URL" --add-label prioritized | ||
- name: Credit Partner Contributions | ||
if: | | ||
github.event_name == 'pull_request_target' | ||
&& steps.author.conclusion != 'skipped' | ||
&& fromJSON(steps.author.outputs.is_partner) | ||
run: | | ||
gh pr edit "$ISSUE_URL" --add-label partner | ||
- name: "Community Check: Assignee" | ||
id: assignee | ||
if: github.event.action == 'assigned' | ||
env: | ||
ASSIGNEE_LOGIN: ${{ github.event.assignee.login }} | ||
run: | | ||
echo "is_maintainer=$(echo $MAINTAINERS | base64 --decode | jq --arg u $ASSIGNEE_LOGIN '. | contains([$u])')" >> "$GITHUB_OUTPUT" | ||
- name: Add prioritized to Maintainer Assignments | ||
if: | | ||
steps.assignee.conclusion != 'skipped' | ||
&& fromJSON(steps.assignee.outputs.is_maintainer)) | ||
run: | | ||
gh $GH_CLI_SUBCOMMAND edit "$ISSUE_URL" --add-label prioritized | ||
- name: "Community Check: Editor" | ||
id: editor | ||
if: github.event.action == 'edited' | ||
env: | ||
EDITOR_LOGIN: ${{ github.event.sender.login }} | ||
run: | | ||
echo "is_maintainer=$(echo $MAINTAINERS | base64 --decode | jq --arg u $ASSIGNEE_LOGIN '. | contains([$u])')" >> "$GITHUB_OUTPUT" | ||
- name: Remove Stale Indicators on Non-Maintainer Edit | ||
if: | | ||
(steps.editor.conclusion != 'skipped' && !fromJSON(steps.editor.outputs.is_maintainer)) | ||
&& (contains(fromJSON(env.LABELS), 'stale') || contains(fromJSON(env.LABELS), 'waiting-response')) | ||
run: | | ||
gh $GH_CLI_SUBCOMMAND edit "$ISSUE_URL" --remove-label stale,waiting-response | ||
- name: "Community Check: Commenter" | ||
id: commenter | ||
if: github.event.action == 'created' | ||
env: | ||
COMMENTER_LOGIN: ${{ github.event.comment.user.login }} | ||
run: | | ||
echo "is_maintainer=$(echo $MAINTAINERS | base64 --decode | jq --arg u $COMMENTER_LOGIN '. | contains([$u])')" >> "$GITHUB_OUTPUT" | ||
- name: Remove Stale Indicators on Non-Maintainer Comment | ||
if: | | ||
(steps.commenter.conclusion != 'skipped' && !fromJSON(steps.commenter.outputs.is_maintainer)) | ||
&& (contains(fromJSON(env.LABELS), 'stale') || contains(fromJSON(env.LABELS), 'waiting-response')) | ||
run: | | ||
gh $GH_CLI_SUBCOMMAND edit "$ISSUE_URL" --remove-label stale,waiting-response | ||
- name: Remove Triage Labels on Closure | ||
if: | | ||
github.event.action == 'closed' | ||
&& (contains(fromJSON(env.LABELS), 'needs-triage') || contains(fromJSON(env.LABELS), 'waiting-response')) | ||
run: | | ||
gh $GH_CLI_SUBCOMMAND edit "$ISSUE_URL" --remove-label needs-triage,waiting-response |
This file was deleted.
Oops, something went wrong.