Skip to content

deps: Add Valinor as dependency #1186

deps: Add Valinor as dependency

deps: Add Valinor as dependency #1186

# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
#
# Use lint-eslint together with lint-eslint-when-unrelated to make eslint a required check for GitHub actions
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
name: Lint eslint
on:
pull_request:
paths-ignore:
- '.github/workflows/**'
- 'src/**'
- 'appinfo/info.xml'
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
- '.eslintrc.*'
- '.eslintignore'
- '**.js'
- '**.ts'
- '**.vue'
env:
PATHS_IGNORE: '.github/workflows/**;src/**;appinfo/info.xml;package.json;package-lock.json;tsconfig.json;.eslintrc.*;.eslintignore;**.js;**.ts;**.vue'
permissions:
contents: read
jobs:
action-no-eslint:
permissions:
contents: none
runs-on: ubuntu-latest
name: action-not-src
outputs:
found_file: ${{ steps.confirm-negative-list.outputs.result }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
- name: Get changed files from diff
id: changed-files
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT
else
echo "changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT
fi
- name: Set up node 20
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3
with:
node-version: 20
- name: Install minimatch
run: npm i minimatch
- name: Check if a file is in paths-ignored
id: confirm-negative-list
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
script: |
const { minimatch } = require('minimatch')
const changedPaths = "${{ steps.changed-files.outputs.changed_files }}".split(' ')
let matched = ''
process.env.PATHS_IGNORE.split(';').every(pattern => {
changedPaths.every(path => {
console.info('Testing ' + path + ' for pattern ' + pattern)
if (minimatch(path, pattern)) {
console.info(path + ' matched, aborting "unrelated summary"')
matched = '1'
return false
}
return true
})
return !matched
})
return matched
lint:
permissions:
contents: none
runs-on: ubuntu-latest
needs: action-no-eslint
name: eslint
if: needs.action-no-eslint.outputs.found_file == ''
steps:
- run: 'echo "No eslint required"'