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/