Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Own prs#359

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
mjpieters wants to merge3 commits intoactions:mainfrommjpieters:own_prs
Closed
Show file tree
Hide file tree
Changes from1 commit
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
PrevPrevious commit
NextNext commit
Fix null handling, covered by integration tests
`core.getInput()` always returns a string, so testing for 'not null'is always true. This then leads to previews set to an array witha single empty string, breaking accept-header output.Updated eslint rules should help avoid this issue in future, and newintegration tests verify that the github client configuration nowreflects the intended configuration options.
  • Loading branch information
@mjpieters
mjpieters committedMar 30, 2023
commit454e5d7e69de69909a6ff10b947f0b5b961d268e
3 changes: 3 additions & 0 deletions.eslintrc.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,8 +6,11 @@ extends:
- plugin:@typescript-eslint/eslint-recommended
- plugin:@typescript-eslint/recommended
- prettier/@typescript-eslint
parserOptions:
project: ['tsconfig.eslint.json']
rules:
# '@typescript-eslint/explicit-function-return-type': 0
'@typescript-eslint/no-use-before-define':
- 2
- functions: false
'@typescript-eslint/no-unnecessary-condition': error
206 changes: 199 additions & 7 deletions.github/workflows/integration.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@ on:

jobs:
test-return:
name: 'Integration test: return'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All@@ -18,26 +19,34 @@ jobs:
result-encoding: string
input-value: output
- run: |
if [[ "${{steps.output-set.outputs.result}}" != "output" ]]; then
echo "- Validating output is produced"
expected="output"
if [[ "${{steps.output-set.outputs.result}}" != "$expected" ]]; then
echo $'::error::\u274C' "Expected '$expected', got ${{steps.output-set.outputs.result}}"
exit 1
fi
echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY

test-relative-require:
name: 'Integration test: relative-path require'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id:output-set
- id:relative-require
uses: ./
with:
script: return require('./package.json').name
result-encoding: string
input-value: output
- run: |
if [[ "${{steps.output-set.outputs.result}}" != "github-script" ]]; then
echo "- Validating relative require output"
if [[ "${{steps.relative-require.outputs.result}}" != "github-script" ]]; then
echo $'::error::\u274C' "Expected '$expected', got ${{steps.relative-require.outputs.result}}"
exit 1
fi
echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY

test-npm-require:
name: 'Integration test: npm package require'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All@@ -47,13 +56,196 @@ jobs:
key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}}
restore-keys: ${{runner.os}}-npm-
- run: npm ci
- id:output-set
- id:npm-require
uses: ./
with:
script: return require('@actions/core/package.json').name
result-encoding: string
input-value: output
- run: |
if [[ "${{steps.output-set.outputs.result}}" != "@actions/core" ]]; then
echo "- Validating npm require output"
expected="@actions/core"
if [[ "${{steps.npm-require.outputs.result}}" != "$expected" ]]; then
echo $'::error::\u274C' "Expected '$expected', got ${{steps.npm-require.outputs.result}}"
exit 1
fi
echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY

test-previews:
name: 'Integration test: previews option'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}}
restore-keys: ${{runner.os}}-npm-
- run: npm ci
- id: previews-default
name: Default previews not set
uses: ./
with:
script: |
const endpoint = github.request.endpoint
return endpoint({}).headers.accept
result-encoding: string
- id: previews-set-single
name: Previews set to a single value
uses: ./
with:
previews: foo
script: |
const endpoint = github.request.endpoint
return endpoint({}).headers.accept
result-encoding: string
- id: previews-set-multiple
name: Previews set to comma-separated list
uses: ./
with:
previews: foo,bar,baz
script: |
const endpoint = github.request.endpoint
return endpoint({}).headers.accept
result-encoding: string
- run: |
echo "- Validating previews default"
expected="application/vnd.github.v3+json"
if [[ "${{steps.previews-default.outputs.result}}" != $expected ]]; then
echo $'::error::\u274C' "Expected '$expected', got ${{steps.previews-default.outputs.result}}"
exit 1
fi
echo "- Validating previews set to a single value"
expected="application/vnd.github.foo-preview+json"
if [[ "${{steps.previews-set-single.outputs.result}}" != $expected ]]; then
echo $'::error::\u274C' "Expected '$expected', got ${{steps.previews-set-single.outputs.result}}"
exit 1
fi
echo "- Validating previews set to multiple values"
expected="application/vnd.github.foo-preview+json,application/vnd.github.bar-preview+json,application/vnd.github.baz-preview+json"
if [[ "${{steps.previews-set-multiple.outputs.result}}" != $expected ]]; then
echo $'::error::\u274C' "Expected '$expected', got ${{steps.previews-set-multiple.outputs.result}}"
exit 1
fi
echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY

test-user-agent:
name: 'Integration test: user-agent option'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}}
restore-keys: ${{runner.os}}-npm-
- run: npm ci
- id: user-agent-default
name: Default user-agent not set
uses: ./
with:
script: |
const endpoint = github.request.endpoint
return endpoint({}).headers['user-agent']
result-encoding: string
- id: user-agent-set
name: User-agent set
uses: ./
with:
user-agent: foobar
script: |
const endpoint = github.request.endpoint
return endpoint({}).headers['user-agent']
result-encoding: string
- id: user-agent-empty
name: User-agent set to an empty string
uses: ./
with:
user-agent: ''
script: |
const endpoint = github.request.endpoint
return endpoint({}).headers['user-agent']
result-encoding: string
- run: |
echo "- Validating user-agent default"
expected="actions/github-script octokit-core.js/"
if [[ "${{steps.user-agent-default.outputs.result}}" != "$expected"* ]]; then
echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-default.outputs.result}}"
exit 1
fi
echo "- Validating user-agent set to a value"
expected="foobar octokit-core.js/"
if [[ "${{steps.user-agent-set.outputs.result}}" != "$expected"* ]]; then
echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-set.outputs.result}}"
exit 1
fi
echo "- Validating user-agent set to an empty string"
expected="octokit-core.js/"
if [[ "${{steps.user-agent-empty.outputs.result}}" != "$expected"* ]]; then
echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-empty.outputs.result}}"
exit 1
fi
echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY

test-debug:
name: 'Integration test: debug option'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}}
restore-keys: ${{runner.os}}-npm-
- run: npm ci
- id: debug-default
name: Default debug not set
uses: ./
with:
script: |
const log = github.log
return {
debug: log.debug === console.debug,
info: log.info === console.info
}
- id: debug-true
name: Debug set to true
uses: ./
with:
debug: true
script: |
const log = github.log
return {
debug: log.debug === console.debug,
info: log.info === console.info
}
- id: debug-false
name: Debug set to false
uses: ./
with:
debug: false
script: |
const log = github.log
return {
debug: log.debug === console.debug,
info: log.info === console.info
}
- run: |
echo "- Validating debug default"
expected='{debug:false,info:false}'
if [[ "${{steps.debug-default.outputs.result}}" != "$expected" ]]; then
echo $'::error::\u274C' "Expected '$expected', got ${{steps.debug-default.outputs.result}}"
exit 1
fi
echo "- Validating debug set to true"
expected='{debug:true,info:true}'
if [[ "${{steps.debug-true.outputs.result}}" != "$expected" ]]; then
echo $'::error::\u274C' "Expected '$expected', got ${{steps.debug-true.outputs.result}}"
exit 1
fi
echo "- Validating debug set to false"
expected='{debug:false,info:false}'
if [[ "${{steps.debug-false.outputs.result}}" != "$expected" ]]; then
echo $'::error::\u274C' "Expected '$expected', got ${{steps.debug-false.outputs.result}}"
exit 1
fi
echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY
Loading

[8]ページ先頭

©2009-2025 Movatter.jp