fix: incorrect params for package upload #22
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
# `dist/index.js` is a special file in Actions. | |
# When you reference an action with `uses:` in a workflow, | |
# `index.js` is the code that will run. | |
# For our project, we generate this file through a build process from other source files. | |
# We need to make sure the checked-in `index.js` actually matches what we expect it to be. | |
name: Check dist/ | |
on: | |
push: | |
branches: | |
- develop | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
workflow_dispatch: | |
jobs: | |
check-dist: | |
name: Check dist/ | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Load secrets from 1Password | |
uses: 1password/load-secrets-action@v2.0.0 | |
id: secrets | |
with: | |
export-env: false | |
env: | |
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_RO }} | |
# | |
APP_ID: 'op://GitHub.Actions/GitHub/corva-bot/APP_ID' | |
PRIVATE_KEY: 'op://GitHub.Actions/GitHub/corva-bot/PRIVATE_KEY' | |
- name: Checkout sources | |
uses: actions/checkout@v4.1.7 | |
with: | |
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | |
- name: Setup Environment | |
uses: ./.github/actions/setup-environment | |
- name: Compare the expected and actual dist/ directories | |
id: diff | |
run: | | |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then | |
echo "Detected uncommitted changes after build. See status below:" | |
git diff | |
exit 1 | |
fi | |
# If index.js was different then expected, upload the expected version as an artifact | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4.3.6 | |
if: ${{ failure() && steps.diff.outcome == 'failure' }} | |
id: artifact | |
with: | |
name: dist | |
path: ./dist/ | |
- name: Generate GitHub token | |
uses: actions/create-github-app-token@v1.10.4 | |
if: ${{ success() || failure() }} | |
id: token | |
with: | |
app-id: ${{ steps.secrets.outputs.APP_ID }} | |
private-key: ${{ steps.secrets.outputs.PRIVATE_KEY }} | |
- name: Add PR status check | |
uses: ouzi-dev/commit-status-updater@v2.0.2 | |
if: ${{ success() || failure() }} | |
with: | |
token: ${{ steps.token.outputs.token }} | |
name: 'Check dist' | |
status: ${{ job.status }} | |
url: ${{ steps.diff.outcome == 'failure' && steps.artifact.outputs.artifact-url || format('https://github.com/{0}/actions/runs/{1}', github.repository, github.run_id) }} | |
description: ${{ job.status == 'success' && 'dist/ is up-to-date' || 'dist/ needs to be updated. Click on "Details" to download updated package' }} |