Skip to content

Commit

Permalink
Updated the test
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed Mar 9, 2023
1 parent 1cd7763 commit 6c3a68a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
29 changes: 24 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ on:
pull_request:
branches:
- main
push:
tags: "**"

jobs:
snapshot:
name: snapshot
runs-on: ubuntu-latest
if: !startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -126,44 +129,60 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Get branch name
id: branch-name
if: startsWith(github.ref, 'refs/tags/')
uses: tj-actions/branch-names@v6
with:
strip_tag_prefix: v

- name: Test action
if: startsWith(github.ref, 'refs/tags/')
uses: ./
with:
version: ${{ steps.branch-name.outputs.tag }}

- name: Run build
if: !startsWith(github.ref, 'refs/tags/')
run: make build

- name: Test action with bin_path
if: !startsWith(github.ref, 'refs/tags/')
uses: ./
with:
bin_path: ./bin/auto_doc

- name: Run auto-doc using the test directory
if: !startsWith(github.ref, 'refs/tags/')
run: make test

- name: Run auto-doc using the top level directory
run: make run
if: github.event.pull_request.head.repo.owner.login == github.repository_owner
if: !startsWith(github.ref, 'refs/tags/') && github.event.pull_request.head.repo.owner.login == github.repository_owner

- name: Format markdown
uses: tj-actions/remark@v3
if: github.event.pull_request.head.repo.owner.login == github.repository_owner
if: !startsWith(github.ref, 'refs/tags/') && github.event.pull_request.head.repo.owner.login == github.repository_owner

- name: Verify Changed files
uses: tj-actions/verify-changed-files@v13
if: github.event.pull_request.head.repo.owner.login == github.repository_owner
if: !startsWith(github.ref, 'refs/tags/') && github.event.pull_request.head.repo.owner.login == github.repository_owner
id: verify-changed-files
with:
files: |
README.md
test/**
- name: Commit README changes
if: github.event.pull_request.head.repo.owner.login == github.repository_owner && steps.verify-changed-files.outputs.files_changed == 'true'
if: !startsWith(github.ref, 'refs/tags/') && github.event.pull_request.head.repo.owner.login == github.repository_owner && steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add ${{ steps.verify-changed-files.outputs.changed_files }}
git commit -m "Updated README."
- name: Push README changes
if: github.event.pull_request.head.repo.owner.login == github.repository_owner && steps.verify-changed-files.outputs.files_changed == 'true'
if: !startsWith(github.ref, 'refs/tags/') && github.event.pull_request.head.repo.owner.login == github.repository_owner && steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
continue-on-error: true
with:
Expand Down
10 changes: 9 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ inputs:
reusable:
description: 'Boolean Indicating whether the file is a reusable workflow'
required: false
version:
description: 'The version number to run'
required: false

runs:
using: 'composite'
Expand All @@ -47,6 +50,7 @@ runs:
EXTRA_ARGS=""
BIN_PATH="${{ inputs.bin_path }}"
REUSABLE="${{ inputs.reusable }}"
VERSION="${{ inputs.version }}"
# action.yml file
INPUT_COLUMNS=(${{ inputs.input_columns }})
OUTPUT_COLUMNS=(${{ inputs.output_columns }})
Expand Down Expand Up @@ -88,7 +92,11 @@ runs:
if [[ -z "$BIN_PATH" ]]; then
TEMP_DIR=$(mktemp -d)
curl -sf https://gobinaries.com/github.com/tj-actions/auto-doc | PREFIX=$TEMP_DIR sh
if [[ -z "$VERSION" ]]; then
curl -sf https://gobinaries.com/github.com/tj-actions/auto-doc | PREFIX=$TEMP_DIR sh
else
curl -sf https://gobinaries.com/github.com/tj-actions/auto-doc@$VERSION | PREFIX=$TEMP_DIR sh
fi
BIN_PATH="$TEMP_DIR/auto-doc"
fi
Expand Down

0 comments on commit 6c3a68a

Please sign in to comment.