Update module github.com/gabriel-vasile/mimetype to v1.4.8 #1555
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
name: test | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
jobs: | |
get-go-version: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.go-version.outputs.version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get Go version | |
id: go-version | |
run: echo "version=$(sed -n 's/^go \([0-9\.]\+\)/\1/p' go.mod)" | tee -a ${GITHUB_OUTPUT} | |
test-nix: | |
runs-on: ${{ matrix.os }} | |
needs: [get-go-version] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '${{ needs.get-go-version.outputs.version }}' | |
- name: Set path | |
run: echo "$(go env GOPATH)/bin" >> ${GITHUB_PATH} | |
- name: Test | |
run: | | |
go vet ./... | |
go test ./... | |
- name: Install scripts | |
run: | | |
mkdir -p "$(go env GOPATH)/bin/" | |
cp scripts/* "$(go env GOPATH)/bin/" | |
- name: Post comment | |
run: bash .ci/upload-test.sh "GitHub Actions ${{ runner.os }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Post comment with -overwrite-existing | |
if: matrix.os == 'ubuntu-latest' | |
run: gh-pr-comment -overwrite-existing "✔ Comment with -overwrite-existing" "Base test" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Post comment with -stdin | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
date | gh-pr-comment -stdin STDIN "✔ Comment with -stdin" 'Text from stdin: | |
``` | |
STDIN```' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Post comment with -overwrite-existing (overwrite) | |
if: matrix.os == 'ubuntu-latest' | |
run: gh-pr-comment -overwrite-existing "✔ Comment with -overwrite-existing" "Overwritten" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Post comment by GITHUB_COMMENT_TOKEN | |
if: matrix.os == 'ubuntu-latest' | |
run: gh-pr-comment -overwrite-existing "✔ Comment with GITHUB_COMMENT_TOKEN" "Text" | |
env: | |
GITHUB_TOKEN: dummy-token | |
GITHUB_COMMENT_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get PR number | |
if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master' | |
id: get-pr-number | |
uses: kamatama41/get-pr-number-action@v0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Post comment from master branch | |
if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master' && steps.get-pr-number.outputs.number != '' | |
run: | | |
gh-pr-comment -pr ${PR} "✔ Comment from master branch" "PR number: ${PR}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PR: ${{ steps.get-pr-number.outputs.number }} | |
- name: Post comment with command exec wrapper | |
if: matrix.os == 'ubuntu-latest' | |
run: gh-pr-comment-exec -c -- ls -x --color=always / | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PR_NUMBER: ${{ steps.get-pr-number.outputs.number }} | |
- name: Post error comment with command exec wrapper | |
if: matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' | |
run: | | |
if gh-pr-comment-exec -c -- false This is expected to be failed | |
then | |
echo "Expected to be failed" >&2 | |
false | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check GoReleaser | |
if: runner.os == 'Linux' | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
version: latest | |
args: check | |
test-windows: | |
runs-on: windows-latest | |
needs: [get-go-version] | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '${{ needs.get-go-version.outputs.version }}' | |
- name: Post comment | |
run: | | |
go install ./... | |
$gobin=$(Join-Path $(go env GOPATH) "bin") | |
$env:PATH="$gobin;" + $env:PATH | |
echo "Test file" > test.txt | |
$env:ALLOW_PUBLIC_UPLOADER="true" | |
$env:IMAGE_UPLOADER="test" | |
gh-pr-upload test.txt | |
if ($?) { | |
$upload="OK" | |
} else { | |
$upload="Failed" | |
} | |
gh-pr-comment "✔ GitHub Actions ${{ runner.os }}" "upload test: ${upload}" | |
if ($upload -match "Failed") { | |
throw | |
} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |