-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update GH actions to use common workflows (#60)
- Loading branch information
1 parent
d03eaaa
commit aaefa7c
Showing
5 changed files
with
32 additions
and
111 deletions.
There are no files selected for viewing
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,9 @@ | ||
name: Lint GitHub Actions Workflows | ||
on: | ||
push: | ||
paths: | ||
- '.github/workflows/**' | ||
jobs: | ||
actionlint: | ||
# using `main` as the ref will keep your workflow up-to-date | ||
uses: hashicorp/vault-workflows-common/.github/workflows/actionlint.yaml@main |
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,7 @@ | ||
name: Go checks | ||
on: | ||
push: | ||
jobs: | ||
go-checks: | ||
# using `main` as the ref will keep your workflow up-to-date | ||
uses: hashicorp/vault-workflows-common/.github/workflows/go-checks.yaml@main |
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 |
---|---|---|
@@ -1,72 +1,19 @@ | ||
name: Jira Sync | ||
on: | ||
issues: | ||
types: [opened, closed, deleted, reopened] | ||
pull_request_target: | ||
types: [opened, closed, reopened] | ||
issue_comment: # Also triggers when commenting on a PR from the conversation view | ||
types: [created] | ||
|
||
name: Jira Sync | ||
|
||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
name: Jira sync | ||
steps: | ||
- name: Login | ||
uses: atlassian/[email protected] | ||
env: | ||
JIRA_BASE_URL: ${{ secrets.JIRA_SYNC_BASE_URL }} | ||
JIRA_USER_EMAIL: ${{ secrets.JIRA_SYNC_USER_EMAIL }} | ||
JIRA_API_TOKEN: ${{ secrets.JIRA_SYNC_API_TOKEN }} | ||
|
||
- name: Preprocess | ||
if: github.event.action == 'opened' || github.event.action == 'created' | ||
id: preprocess | ||
run: | | ||
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then | ||
echo "::set-output name=type::PR" | ||
else | ||
echo "::set-output name=type::ISS" | ||
fi | ||
- name: Create ticket | ||
if: github.event.action == 'opened' | ||
uses: tomhjp/[email protected] | ||
with: | ||
project: VAULT | ||
issuetype: "GH Issue" | ||
summary: "${{ github.event.repository.name }} [${{ steps.preprocess.outputs.type }} #${{ github.event.issue.number || github.event.pull_request.number }}]: ${{ github.event.issue.title || github.event.pull_request.title }}" | ||
description: "${{ github.event.issue.body || github.event.pull_request.body }}\n\n_Created from GitHub Action for ${{ github.event.issue.html_url || github.event.pull_request.html_url }} from ${{ github.actor }}_" | ||
# customfield_10089 is Issue Link custom field | ||
# customfield_10091 is team custom field | ||
extraFields: '{"fixVersions": [{"name": "TBD"}], "customfield_10091": ["ecosystem", "applications"], "customfield_10089": "${{ github.event.issue.html_url || github.event.pull_request.html_url }}"}' | ||
|
||
- name: Search | ||
if: github.event.action != 'opened' | ||
id: search | ||
uses: tomhjp/[email protected] | ||
with: | ||
# cf[10089] is Issue Link custom field | ||
jql: 'project = "VAULT" and cf[10089]="${{ github.event.issue.html_url || github.event.pull_request.html_url }}"' | ||
|
||
- name: Sync comment | ||
if: github.event.action == 'created' && steps.search.outputs.issue | ||
uses: tomhjp/[email protected] | ||
with: | ||
issue: ${{ steps.search.outputs.issue }} | ||
comment: "${{ github.actor }} ${{ github.event.review.state || 'commented' }}:\n\n${{ github.event.comment.body || github.event.review.body }}\n\n${{ github.event.comment.html_url || github.event.review.html_url }}" | ||
|
||
- name: Close ticket | ||
if: (github.event.action == 'closed' || github.event.action == 'deleted') && steps.search.outputs.issue | ||
uses: atlassian/[email protected] | ||
with: | ||
issue: ${{ steps.search.outputs.issue }} | ||
transition: Close | ||
|
||
- name: Reopen ticket | ||
if: github.event.action == 'reopened' && steps.search.outputs.issue | ||
uses: atlassian/[email protected] | ||
with: | ||
issue: ${{ steps.search.outputs.issue }} | ||
transition: "Pending Triage" | ||
uses: hashicorp/vault-workflows-common/.github/workflows/jira.yaml@main | ||
# assuming you use Vault to get secrets | ||
# if you use GitHub secrets, use secrets.XYZ instead of steps.secrets.outputs.XYZ | ||
secrets: | ||
JIRA_SYNC_BASE_URL: ${{ secrets.JIRA_SYNC_BASE_URL }} | ||
JIRA_SYNC_USER_EMAIL: ${{ secrets.JIRA_SYNC_USER_EMAIL }} | ||
JIRA_SYNC_API_TOKEN: ${{ secrets.JIRA_SYNC_API_TOKEN }} | ||
with: | ||
teams-array: '["ecosystem", "applications"]' |
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 |
---|---|---|
@@ -1,47 +1,7 @@ | ||
name: Tests | ||
|
||
on: [push, workflow_dispatch] | ||
|
||
name: Run Tests | ||
on: | ||
push: | ||
jobs: | ||
get-go-version: | ||
name: "Determine Go toolchain version" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
go-version: ${{ steps.get-go-version.outputs.go-version }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Determine Go version | ||
id: get-go-version | ||
run: | | ||
echo "Building with Go $(cat .go-version)" | ||
echo "::set-output name=go-version::$(cat .go-version)" | ||
fmtcheck: | ||
runs-on: ubuntu-latest | ||
needs: [get-go-version] | ||
env: | ||
GOFUMPT_VERSION: 0.3.1 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ needs.get-go-version.outputs.go-version }} | ||
- run: | | ||
go install "mvdan.cc/gofumpt@v${GOFUMPT_VERSION}" | ||
make fmtcheck | ||
test: | ||
runs-on: ubuntu-latest | ||
needs: [get-go-version] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ needs.get-go-version.outputs.go-version }} | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- run: make test | ||
run-tests: | ||
# using `main` as the ref will keep your workflow up-to-date | ||
uses: hashicorp/vault-workflows-common/.github/workflows/tests.yaml@main |
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 |
---|---|---|
|
@@ -81,5 +81,3 @@ tmp/ | |
|
||
scripts/custom.sh | ||
|
||
# binary | ||
bin/vault-plugin-auth-openldap |