diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml new file mode 100644 index 00000000..8aec95d4 --- /dev/null +++ b/.github/workflows/fossa.yml @@ -0,0 +1,70 @@ +name: Fossa + +on: + push: + branches: + - master + paths-ignore: + - '**.md' + - 'LICENSE' + +jobs: + + scan: + name: Fossa + runs-on: ubuntu-20.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Scan + uses: fossas/fossa-action@v1 + with: + api-key: ${{ secrets.FOSSA_TOKEN }} + + notify: + name: Notify + runs-on: ubuntu-20.04 + needs: scan + if: always() + steps: + - name: Workflow Status + id: check + uses: martialonline/workflow-status@v2 + - name: Output Variables + id: commit + run: | + echo "::set-output name=sha::$(echo ${GITHUB_SHA} | cut -c1-7)" + echo "::set-output name=repo::${GITHUB_REPOSITORY#*/}" + - name: Send Notification + uses: 8398a7/action-slack@v3 + if: steps.check.outputs.status == 'failure' + with: + status: custom + custom_payload: | + { + username: 'Fossa Scan', + icon_emoji: ':fossa:', + mention: 'channel', + attachments: [{ + title: '[${{ steps.commit.outputs.repo }}] ${{ github.workflow }} license scan has failed', + color: 'danger', + fields: [{ + title: 'Commit Hash', + value: '${{ steps.commit.outputs.sha }}', + short: true + }, + { + title: 'Author', + value: '${{ github.actor }}', + short: true + }, + { + title: 'Job URL', + value: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}', + short: false + }] + }] + } + env: + GITHUB_TOKEN: ${{ github.token }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} diff --git a/README.md b/README.md index 437b1e95..dae6e583 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Continuous Integration](https://github.com/nginxinc/nginx-ingress-operator/workflows/Continuous%20Integration/badge.svg)](https://github.com/nginxinc/nginx-ingress-operator/actions) +[![Continuous Integration](https://github.com/nginxinc/nginx-ingress-operator/workflows/Continuous%20Integration/badge.svg)](https://github.com/nginxinc/nginx-ingress-operator/actions) [![FOSSA Status](https://app.fossa.io/api/projects/custom%2B1062%2Fgithub.com%2Fnginxinc%2Fnginx-ingress-operator.svg?type=shield)](https://app.fossa.io/projects/custom%2B1062%2Fgithub.com%2Fnginxinc%2Fnginx-ingress-operator?ref=badge_shield) # NGINX Ingress Operator