Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow to handle regressions #1773

Merged
merged 7 commits into from
Sep 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/workflows/regressions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Handle Label Notifications
permissions: {}

on:
issues:
types:
- labeled

pull_request_target:
types:
- labeled

jobs:
process:
name: Process Label
if: github.event.label.name == 'regression' || github.event.label.name == 'crash'
runs-on: ubuntu-latest

env:
ISSUE_URL: ${{ github.event.issue.html_url || github.event.pull_request.html_url }}

steps:
- name: Send Slack Notification
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
env:
ISSUE_TITLE: ${{ toJSON(github.event.issue.title || github.event.pull_request.title) }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
channel-id: ${{ secrets.SLACK_CHANNEL }}
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":warning: The following has been labeled as a ${{ github.event.label.name }}:"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{ toJSON(format('<{0}|{1}>', env.ISSUE_URL, env.ISSUE_TITLE)) }}
}
}
]
}

- name: Generate GitHub App Token
id: token
uses: actions/create-github-app-token@c8f55efbd427e7465d6da1106e7979bc8aaee856 # v1.10.1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PEM }}

- name: Add prioritized Label
env:
GH_CLI_SUBCOMMAND: ${{ github.event_name == 'pull_request_target' && 'pr' || 'issue' }}
GH_TOKEN: ${{ steps.token.outputs.token }}
run: |
gh $GH_CLI_SUBCOMMAND edit "$ISSUE_URL" --add-label prioritized

- name: Move to the Top of the Team Working Board
env:
GH_TOKEN: ${{ steps.token.outputs.token }}
run: |
PROJECT_ITEM_ID=$(gh project item-add 196 --owner "hashicorp" --url "$ISSUE_URL" --format json --jq '.id')

gh project item-edit \
--id "$PROJECT_ITEM_ID" \
--project-id "PVT_kwDOAAuecM4AF-7h" \
--field-id "PVTSSF_lADOAAuecM4AF-7hzgMRB34" \
--single-select-option-id "${{ vars.team_project_view_working_board }}"

gh api graphql \
-F itemId="$PROJECT_ITEM_ID" \
-F projectId="PVT_kwDOAAuecM4AF-7h" \
-f query='mutation($itemId:ID!, $projectId:ID!) {
updateProjectV2ItemPosition(input:{itemId:$itemId, projectId:$projectId}) {
clientMutationId
}
}'