Skip to content

Commit

Permalink
Removinf redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
KasukabeDefenceForce committed Apr 25, 2024
1 parent 5677bca commit 40ba4b1
Showing 1 changed file with 5 additions and 53 deletions.
58 changes: 5 additions & 53 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,61 +88,13 @@ jobs:
ref: ${{ github.event.pull_request.head.ref }}
if: github.event_name == 'pull_request_target'

- name: Check for trigger by push event, manual dispatch, build-docs label on a PR
id: trigger_check
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'build-docs')
run: |
echo "Building docs as a test."
exit 0
continue-on-error: true

- name: Check for changes in documentation
run: |
if git diff origin/master..."$(git rev-parse --abbrev-ref HEAD)" --name-only | cat | grep 'docs' | grep -q .; then
num_files=$(git diff --name-only origin/master...HEAD | grep '^docs/' | wc -l)
echo "Changes found in documentation files: $num_files"
exit 0
else
echo "No changes found in documentation files"
exit 1
fi
id: docs_check
if: steps.trigger_check.outcome != 'success'
continue-on-error: true

- name: Print Exit code
run: |
if [[ $GITHUB_EVENT_NAME == 'push' ]]; then
echo "Workflow triggered by push event."
exit 0
else
echo "Workflow triggered by a different event: $GITHUB_EVENT_NAME"
exit 1
fi
continue-on-error: true

- name: Check for workflow dispatch
id: is_workflow_dispatch
if: github.event_name == 'workflow_dispatch'
run: exit 0
continue-on-error: true

- name: Check for pull request with 'build-docs' label
id: is_build_docs_label
if: github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'build-docs')
- name: Generate Cache Key
run: |
exit 0
continue-on-error: true

- name: Setup environment
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: tardis
use-mamba: true
file_hash=$(cat conda-linux-64.lock | shasum -a 256 | cut -d' ' -f1)
echo "file_hash=$file_hash" >> "${GITHUB_OUTPUT}"
id: cache-environment-key

- uses: actions/cache@v2
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: conda-linux-64.lock
cache-environment-key: ${{ steps.cache-environment-key.outputs.file_hash }}
Expand Down

0 comments on commit 40ba4b1

Please sign in to comment.