Skip to content

Merge branch 'issue/NT-fix-add-pr-url-https' into develop #57

Merge branch 'issue/NT-fix-add-pr-url-https' into develop

Merge branch 'issue/NT-fix-add-pr-url-https' into develop #57

Workflow file for this run

name: 'Test Actions'
on:
push:
branches:
- develop
- renovate/**
defaults:
run:
shell: bash
jobs:
changes:
name: Detect file changes
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
add-pr-url: ${{ steps.filter.outputs.add-pr-url }}
load-env: ${{ steps.filter.outputs.load-env }}
detect-pod: ${{ steps.filter.outputs.detect-pod }}
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Check out the repo
uses: actions/checkout@v3
- name: Find file changes
uses: dorny/paths-filter@v2
id: filter
with:
base: ${{ github.event.before }}
filters: |
add-pr-url:
- 'actions/add-pr-url/**'
- '.github/workflows/test.yml'
load-env:
- 'actions/load-env/**'
- '.github/workflows/test.yml'
detect-pod:
- 'actions/detect-pod/**'
- '.github/workflows/test.yml'
test-add-pr-url:
name: Test add-pr-url
runs-on: ubuntu-latest
needs: [changes]
if: ${{ needs.changes.outputs.add-pr-url == 'true' }}
steps:
- name: Add url link to PR
uses: phase2/octane-actions/actions/add-pr-url@develop
with:
url: www.example.com
caption: Test Link
- name: Add existing https link to PR
uses: phase2/octane-actions/actions/add-pr-url@develop
with:
url: https://www.example.com
caption: Test Https Link
- name: Add second url link to PR
uses: phase2/octane-actions/actions/add-pr-url@develop
with:
url: www.google.com
caption: Second Test Link
fetch: true
test-load-env:
name: Test load-env
runs-on: ubuntu-latest
needs: [changes]
if: ${{ needs.changes.outputs.load-env == 'true' }}
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Load environment
id: set_env
uses: phase2/octane-actions/actions/load-env@develop
- name: Environment vars
run: env
- name: Validate results
env:
NODE_OPTIONS: ${{steps.set_env.outputs.node_options}}
run: |
result=0
echo "NODE_OPTIONS: $NODE_OPTIONS"
if [ "$NODE_OPTIONS" != "test" ]; then
echo "ERROR handling NODE_OPTIONS in .env file"
result=1
fi
echo "PROJECT_NAME: $PROJECT_NAME"
if [ "$PROJECT_NAME" != "octane-actions" ]; then
echo "ERROR loading .env file"
result=1
fi
echo "CI_URL: $CI_URL"
if [ "$CI_URL" != "devcloud.fayze2.com" ]; then
echo "ERROR setting CI_URL"
result=1
fi
echo "CI_BRANCH: $CI_BRANCH"
if [ "$CI_BRANCH" != "$GITHUB_REF_NAME" ]; then
echo "ERROR setting CI_BRANCH"
result=1
fi
if [[ ! -z $(which npm 2>/dev/null || echo "") ]]; then
npmConfig=$(npm config get prefix)
echo "npm config get prefix: $npmConfig"
if [ "$npmConfig" != "/home/runner/work/octane-actions/octane-actions/.config/npm/global" ]; then
echo "ERROR setting npm config"
result=1
fi
fi
exit $result
test-detect-pod:
name: Test detect-pod
runs-on: ubuntu-latest
needs: [changes]
if: ${{ needs.changes.outputs.detect-pod == 'true' }}
env:
# Check if Phase2 demo project has a pod for main branch.
GENERATOR_PROJECT_NAME: demo
GENERATOR_NAMESPACE: demo
POD_RELEASE_NAME: main
steps:
- name: Find Devcloud pod
uses: phase2/octane-actions/actions/detect-pod@develop
id: detect-pod
with:
kubeconfig: ${{ secrets.KUBE_CONFIG }}
release_name: ${{ env.POD_RELEASE_NAME }}
- name: Validate pod status
run: |
result=0
echo "Pod status: ${{ steps.detect-pod.outputs.pod-status }}"
if [ "${{ steps.detect-pod.outputs.pod-status }}" != "true" ]; then
echo "ERROR finding pod for namespace: $GENERATOR_NAMESPACE release: $POD_RELEASE_NAME"
result=1
fi
exit $result