diff --git a/.github/workflows/label-notifications.yml b/.github/workflows/label-notifications.yml new file mode 100644 index 000000000..81af42267 --- /dev/null +++ b/.github/workflows/label-notifications.yml @@ -0,0 +1,76 @@ +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@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.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: [AWSCC] 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@3378cda945da322a8db4b193e19d46352ebe2de5 # v1.10.4 + with: + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PEM }} + + - 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 + } + }' diff --git a/.github/workflows/pull_request_feed.yml b/.github/workflows/pull_request_feed.yml new file mode 100644 index 000000000..61233ae05 --- /dev/null +++ b/.github/workflows/pull_request_feed.yml @@ -0,0 +1,97 @@ +name: Pull Request Feed + +on: + pull_request_target: + types: [opened, closed] + +permissions: + contents: read + +env: + SLACK_WEBHOOK_URL: ${{ secrets.FEED_SLACK_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + PR_HTML_URL: ${{ github.event.pull_request.html_url }} + PR_TITLE: ${{ github.event.pull_request.title }} + +jobs: + feed: + name: Slack Notifications + runs-on: ubuntu-latest + steps: + - name: Checkout Community Check + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + sparse-checkout: .github/actions/community_check + + - name: Run Community Check + id: community_check + uses: ./.github/actions/community_check + with: + user_login: ${{ github.event.pull_request.user.login }} + maintainers: ${{ secrets.MAINTAINERS }} + partners: ${{ secrets.PARTNERS }} + + - name: Pull Request Merged + if: github.event.pull_request.merged + uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0 + env: + MERGED_BY_URL: ${{ github.event.pull_request.merged_by.html_url }} + MERGED_BY_LOGIN: ${{ github.event.pull_request.merged_by.login }} + with: + payload: | + { + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": ${{ toJSON(format(':merged: [AWSCC] <{0}|{1}> merged <{2}|{3}>', env.MERGED_BY_URL, env.MERGED_BY_LOGIN, env.PR_HTML_URL, env.PR_TITLE)) }} + } + } + ] + } + + - name: Maintainer Pull Request Opened + if: | + github.event.action == 'opened' + && steps.community_check.outputs.maintainer == 'true' + && github.actor != 'dependabot[bot]' + uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0 + env: + PR_AUTHOR_URL: ${{ github.event.pull_request.user.html_url }} + PR_AUTHOR_LOGIN: ${{ github.event.pull_request.user.login }} + with: + payload: | + { + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": ${{ toJSON(format(':open: [AWSCC] <{0}|{1}> opened <{2}|{3}>', env.PR_AUTHOR_URL, env.PR_AUTHOR_LOGIN, env.PR_HTML_URL, env.PR_TITLE)) }} + } + } + ] + } + + - name: Partner Pull Request Opened + if: | + github.event.action == 'opened' + && steps.community_check.outputs.partner == 'true' + uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0 + env: + PR_AUTHOR_URL: ${{ github.event.pull_request.user.html_url }} + PR_AUTHOR_LOGIN: ${{ github.event.pull_request.user.login }} + with: + payload: | + { + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": ${{ toJSON(format(':open: [AWSCC] :aws: contributor <{0}|{1}> opened <{2}|{3}>', env.PR_AUTHOR_URL, env.PR_AUTHOR_LOGIN, env.PR_HTML_URL, env.PR_TITLE)) }} + } + } + ] + } diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml new file mode 100644 index 000000000..e65d71e80 --- /dev/null +++ b/.github/workflows/release-tag.yml @@ -0,0 +1,28 @@ +name: "Feed: Release Tag" +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+*' +jobs: + tag-created: + runs-on: ubuntu-latest + steps: + - name: Notify Slack + id: slack + uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0 + with: + payload: | + { + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": ":tag: [AWSCC] pushed tag " + } + } + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.FEED_SLACK_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK