Add dist/ check to CI (#8)

This commit is contained in:
Mieszko Grodzicki 2023-02-21 12:18:52 +01:00 committed by Predrag Gruevski
parent b74920e5d3
commit aa69e72300
5 changed files with 94 additions and 13 deletions

View file

@ -7,6 +7,10 @@ on:
- main - main
jobs: jobs:
compare-dist:
name: Check if compiled action in dist/ matches the source files
uses: ./.github/workflows/compare-dist.yml
test-action: test-action:
name: Test the action on ubuntu-latest name: Test the action on ubuntu-latest
uses: ./.github/workflows/test-action.yml uses: ./.github/workflows/test-action.yml

39
.github/workflows/compare-dist.yml vendored Normal file
View file

@ -0,0 +1,39 @@
name: Check if compiled action in dist/ matches the source files
on:
workflow_call:
jobs:
compare-dist:
name: Check dist/
runs-on: ubuntu-latest
steps:
- name: Checkout the action
uses: actions/checkout@v3
- name: Setup Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install npm-cli-login
run: npm install -g npm-cli-login
- name: Login to GitHub npm registry
run: |
npm-cli-login -s @actions-rs -r https://npm.pkg.github.com \
-u $ -p ${{ secrets.GITHUB_TOKEN }} -e test@example.com
- name: Install dependencies
run: npm ci
- name: Rebuild the action
run: npm run build
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build."
exit 1
fi
id: diff
- name: Upload the expected version in case of failure
uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: expected-dist
path: dist/

22
dist/index.js vendored

File diff suppressed because one or more lines are too long

38
package-lock.json generated
View file

@ -17,7 +17,9 @@
"@types/node-fetch": "^2.6.2" "@types/node-fetch": "^2.6.2"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^18.11.18" "@types/node": "^18.11.18",
"@vercel/ncc": "^0.36.1",
"typescript": "^4.9.5"
} }
}, },
"node_modules/@actions-rs/core": { "node_modules/@actions-rs/core": {
@ -593,6 +595,15 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"node_modules/@vercel/ncc": {
"version": "0.36.1",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.36.1.tgz",
"integrity": "sha512-S4cL7Taa9yb5qbv+6wLgiKVZ03Qfkc4jGRuiUQMQ8HGBD5pcNRnHeYM33zBvJE4/zJGjJJ8GScB+WmTsn9mORw==",
"dev": true,
"bin": {
"ncc": "dist/ncc/cli.js"
}
},
"node_modules/abort-controller": { "node_modules/abort-controller": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
@ -845,6 +856,19 @@
"node": ">=0.6.11 <=0.7.0 || >=0.7.3" "node": ">=0.6.11 <=0.7.0 || >=0.7.3"
} }
}, },
"node_modules/typescript": {
"version": "4.9.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
},
"node_modules/universal-user-agent": { "node_modules/universal-user-agent": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
@ -1450,6 +1474,12 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"@vercel/ncc": {
"version": "0.36.1",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.36.1.tgz",
"integrity": "sha512-S4cL7Taa9yb5qbv+6wLgiKVZ03Qfkc4jGRuiUQMQ8HGBD5pcNRnHeYM33zBvJE4/zJGjJJ8GScB+WmTsn9mORw==",
"dev": true
},
"abort-controller": { "abort-controller": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
@ -1640,6 +1670,12 @@
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="
}, },
"typescript": {
"version": "4.9.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
"dev": true
},
"universal-user-agent": { "universal-user-agent": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz",

View file

@ -26,6 +26,8 @@
"@types/node-fetch": "^2.6.2" "@types/node-fetch": "^2.6.2"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^18.11.18" "@types/node": "^18.11.18",
"@vercel/ncc": "^0.36.1",
"typescript": "^4.9.5"
} }
} }