forked from compdemocracy/polis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix github status checks when submitting PR from fork (compdemocracy#520
) * Fixed depcheck workflow issue. * Run lint on all PRs. * Try fixing depcheck. * Trying to skip steps by checking secret value. * Try using set-env to tell depcheck when secrets available. * Trying new way to get depcheck working on fork. * One more thing.
- Loading branch information
Showing
2 changed files
with
12 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,15 @@ jobs: | |
CI_COMMIT_ID: ${{ github.event.pull_request.head.sha || github.sha }} | ||
CI_REPO_NAME: ${{ github.repository }} | ||
steps: | ||
# See: https://github.community/t/if-expression-with-context-variable/16558/6 | ||
- name: Check if secrets available | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
unset HAS_SECRET | ||
if [ -n "$GITHUB_TOKEN" ]; then HAS_SECRET=true; fi | ||
echo ::set-env name=HAS_SECRET::${HAS_SECRET} | ||
- name: Use Node.js | ||
uses: actions/[email protected] | ||
with: | ||
|
@@ -24,6 +33,7 @@ jobs: | |
run: npm install -g commit-status | ||
|
||
- name: Initiate commit status placeholders | ||
if: github.event.pull_request.head.repo.full_name == github.repository | ||
run: | | ||
# commit-status <state> <context> <description> <link> | ||
commit-status pending "DepCheck / dependencies" "Detecting unused packages..." | ||
|
@@ -57,6 +67,7 @@ jobs: | |
echo ::set-output name=devdependencies::$(cat .results.json | jq '.devDependencies | join(", ") | .[:139]' --raw-output) | ||
- name: Set commit status messages and success states | ||
if: github.event.pull_request.head.repo.full_name == github.repository | ||
run: | | ||
if [ "${{ steps.depcheck.outputs.dependencies }}" = "" ]; then | ||
commit-status success "DepCheck / dependencies" "No unused packages detected." | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,11 @@ name: Lint | |
|
||
on: | ||
pull_request: | ||
types: ["opened", "reopened", "synchronize"] | ||
|
||
jobs: | ||
eslint: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
|