Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 2 additions & 8 deletions go/build-and-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,12 @@ runs:
id: get-short-sha
run: echo "short_sha=`echo ${GITHUB_SHA::7}`" > $GITHUB_OUTPUT
shell: bash
- name: Configure Go environment
uses: wishabi/github-actions/go/configure@v0
- name: Run custom Go build action
uses: wishabi/github-actions/go/build@skip-test
with:
FLIPPCIRCLECIPULLER_REPO_TOKEN: ${{ inputs.FLIPPCIRCLECIPULLER_REPO_TOKEN }}
BUF_BUILD_USER: ${{ inputs.BUF_BUILD_USER }}
BUF_BUILD_API_TOKEN: ${{ inputs.BUF_BUILD_API_TOKEN }}
- name: Setup Go dependencies
uses: wishabi/github-actions/go/deps@v0
env:
BUF_TOKEN: ${{ inputs.BUF_BUILD_API_TOKEN }}
with:
FLIPPCIRCLECIPULLER_REPO_TOKEN: ${{ inputs.FLIPPCIRCLECIPULLER_REPO_TOKEN }}
- name: Run custom Go test action
uses: wishabi/github-actions/go/test@v0
env:
Expand Down
119 changes: 119 additions & 0 deletions go/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: "Go Build"
description: "Build go repo"

inputs:
FLIPPCIRCLECIPULLER_REPO_TOKEN:
description: Flipp circleci repo token
required: true
BUF_BUILD_USER:
description: Buf CI user stored as secret
required: false
BUF_BUILD_API_TOKEN:
description: Buf API token stored as secret
required: false
SLACK_CHANNEL_ID:
description: The Slack channel ID(s) to send the data to
required: false
SLACK_BOT_TOKEN:
description: The Slack bot token to pass the data to
required: false

runs:
using: "composite"
steps:
- name: Set branch variable
id: set-branch
shell: bash
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
branch="${{ github.event.pull_request.head.ref }}"
else
branch="${{ github.ref }}"
branch="${branch#refs/heads/}"
fi
echo "branch=${branch}" >> $GITHUB_OUTPUT
- name: Get short sha
id: get-short-sha
run: echo "short_sha=`echo ${GITHUB_SHA::7}`" > $GITHUB_OUTPUT
shell: bash
- name: Configure Go environment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this one need configure and the old build and test action didnt?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it did :P
image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read the diff wrong

uses: wishabi/github-actions/go/configure@v0
with:
FLIPPCIRCLECIPULLER_REPO_TOKEN: ${{ inputs.FLIPPCIRCLECIPULLER_REPO_TOKEN }}
BUF_BUILD_USER: ${{ inputs.BUF_BUILD_USER }}
BUF_BUILD_API_TOKEN: ${{ inputs.BUF_BUILD_API_TOKEN }}
- name: Setup Go dependencies
uses: wishabi/github-actions/go/deps@v0
env:
BUF_TOKEN: ${{ inputs.BUF_BUILD_API_TOKEN }}
with:
FLIPPCIRCLECIPULLER_REPO_TOKEN: ${{ inputs.FLIPPCIRCLECIPULLER_REPO_TOKEN }}
- name: Notify slack channel on failure
if: failure() && inputs.SLACK_CHANNEL_ID != null && github.ref == 'refs/heads/main'
uses: slackapi/slack-github-action@v1.24.0
env:
SLACK_BOT_TOKEN: ${{ inputs.SLACK_BOT_TOKEN }}
with:
channel-id: ${{ inputs.SLACK_CHANNEL_ID }}
payload: |
{
"text": "Go Build Failed",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Go Build Failed",
"emoji": true
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Repository*\n<https://github.com/${{ github.repository }}|${{ github.repository }}>\n\n*${{ github.event_name == 'pull_request' && 'Pull Request' || 'Branch' }}*\n${{ github.event_name == 'pull_request' && format('<{0}|{1}>', github.event.pull_request.html_url, github.event.pull_request.title) || format('<https://github.com/{0}/commit/{1}|{2}>', github.repository, github.sha, steps.set-branch.outputs.branch)}}"
},
"accessory": {
"type": "image",
"image_url": "https://emoji.slack-edge.com/T02AJQYGN/fail/d35657341d0b7dc4.png",
"alt_text": "error icon"
}
},
{
"type": "divider"
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Version/Commit*"
},
{
"type": "mrkdwn",
"text": "*Event*"
},
{
"type": "mrkdwn",
"text": "${{ steps.get-short-sha.outputs.short_sha }}"
},
{
"type": "mrkdwn",
"text": "${{ github.event_name }}"
}
]
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "*Triggered By:* ${{ github.triggering_actor }}"
}
]
}
]
}
Loading