Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add Open Source Policy Workflow #23

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/repolinter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# NOTE: This file should always be named `repolinter.yml` to allow
# workflow_dispatch to work properly
name: Repolinter Action

# NOTE: This workflow will ONLY check the default branch!
# Currently there is no elegant way to specify the default
# branch in the event filtering, so branches are instead
# filtered in the "Test Default Branch" step.
on: [push, workflow_dispatch]

jobs:
repolint:
name: Run Repolinter
runs-on: ubuntu-latest
steps:
- name: Test Default Branch
id: default-branch
uses: actions/github-script@v2
with:
script: |
const data = await github.repos.get(context.repo)
return data.data && data.data.default_branch === context.ref.split('/').slice(-1)[0]
- name: Checkout Self
if: ${{ steps.default-branch.outputs.result == 'true' }}
uses: actions/checkout@v2
- name: Run Repolinter
if: ${{ steps.default-branch.outputs.result == 'true' }}
uses: newrelic/repolinter-action@v1
with:
config_file: test_policy.yaml
output_type: issue
3 changes: 0 additions & 3 deletions README.md

This file was deleted.

17 changes: 17 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
**********************
My Open Source Project
**********************

Hello world! This repository (and its organization) is designed to showcase `repolinter <https://github.com/todogroup/repolinter>`_. The code in this project is based on Microsoft's `TypeScript React Starter <https://github.com/microsoft/TypeScript-React-Starter>`_, and is licensed under MIT unless otherwise indicated.

Useful Links
============

* `Code of Conduct <./CODE_OF_CONDUCT.md>`_
* `License <./LICENCE>`_
* `Typo URL <example.com/notapath>`_
* `New Relic Discuss Topic <https://discuss.newrelic.com/companion-cube>`_
* `Security Policy <../../security/policy>`_
* `Private Source Link <https://source.datanerd.us>`_
* Relative Section Link: `Useful Links`_

94 changes: 94 additions & 0 deletions test_policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Schema: https://github.com/raw/newrelic-forks/repolinter/master/rulesets/schema.json
version: 2
axioms: {}
rules:
readme-no-broken-links:
level: error
rule:
type: file-no-broken-links
options:
globsAll:
- README*
nocase: true
pass-external-relative-links: true
readme-file-exists:
level: error
rule:
type: file-existence
options:
globsAny:
- README*
nocase: true
fix:
type: file-create
options:
file: README.md
text:
url: https://github.com/raw/newrelic/open-source-tools/master/nerdpacks/oss-template/README.md
policyInfo: >-
New Relic requires a README file in all projects. This README should
give a general overview of the project, and should point to additional resources
(security, contributing, etc.) where developers and users can learn further
policyUrl: https://github.com/newrelic/open-by-default
readme-contains-discuss-topic:
level: error
rule:
type: file-contents
options:
globsAll:
- README*
fail-on-non-exist: true
flags: i
content: discuss\.newrelic\.com
human-readable-content: a link to the appropriate discuss.newrelic.com topic
policyInfo: >-
New Relic recommends directly linking the your appropriate discuss.newrelic.com
topic in the README, allowing developer an alternate method of getting support
policyUrl: https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code
code-of-conduct-file-does-not-exist:
level: error
rule:
type: file-not-exists
options:
globsAll:
- CODE_OF_CONDUCT*
- CODE-OF-CONDUCT*
- CODEOFCODUCT
nocase: true
fix:
type: file-remove
options: {}
policyInfo: >-
New Relic has moved the `CODE_OF_CONDUCT` file to a [centralized location](https://github.com/newrelic/.github/blob/main/CODE_OF_CONDUCT.md)
where it is referenced automatically by every repository in the New Relic organization. Because of this change, any other `CODE_OF_CONDUCT` file
in a repository is now redundant and should be removed
policyUrl: https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view
third-party-notices-file-exists:
level: warning
rule:
type: file-existence
options:
globsAny:
- THIRD_PARTY_NOTICES*
- THIRD-PARTY-NOTICES*
- THIRDPARTYNOTICES*
nocase: true
policyInfo: >-
A [`THIRD_PARTY_NOTICES.md`](https://github.com/newrelic/opensource-website/blob/develop/THIRD_PARTY_NOTICES.md)
file can be present in your repository to grant attribution to all dependencies
being used by this project. This document is necessary if you are using
third-party source code in your project, with the exception of code referenced outside
the project's compiled/bundled binary (ex. some Java projects require modules to
be pre-installed in the classpath, outside the project binary and therefore
outside the scope of the `THIRD_PARTY_NOTICES`). Please
review your project's dependencies and create a THIRD_PARTY_NOTICES.md file if
necessary. For JavaScript projects, you can generate this file using the
[oss-cli](https://github.com/newrelic/newrelic-oss-cli)
policyUrl: https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view
formatOptions:
disclaimer: >-
🤖*This issue was automatically generated by [repolinter-action](https://github.com/newrelic/repolinter-action),
developed by the Open Source and Developer Advocacy team at New Relic. This issue
will be automatically updated or closed when changes are pushed. If you have any
problems with this tool, please feel free to open a GitHub issue or give us a
ping in #help-opensource.*