Workflow file for this run
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
name: Refresh dist files | |
on: | |
pull_request: | |
types: [labeled] | |
jobs: | |
refresh: | |
if: contains(github.event.pull_request.labels.*.name, 'refresh dist') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
- id: changed-package-json | |
uses: tj-actions/changed-files@v44 | |
with: | |
files: | | |
**/package.json | |
**/package-lock.json | |
- id: changed-features | |
uses: tj-actions/changed-files@v44 | |
with: | |
files: | | |
features/**/*.yml | |
features/**/*.yml.dist | |
- uses: actions/setup-node@v4 | |
if: steps.changed-features.outputs.any_changed == 'true' | |
- run: npm install | |
if: steps.changed-features.outputs.any_changed == 'true' | |
- name: Refresh dist files for feature changes | |
if: steps.changed-package-json.outputs.any_changed == 'false' && steps.changed-features.outputs.any_changed == 'true' | |
env: | |
CHANGED_FEATURES: ${{ steps.changed-features.outputs.all_changed_files }} | |
run: | | |
npm run dist -- ${CHANGED_FEATURES} | |
- name: Refresh all dist files (for package*.json changes) | |
if: steps.changed-package-json.outputs.any_changed == 'true' | |
run: | | |
npm run dist | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
if: steps.changed-package-json.outputs.any_changed == 'true' || steps.changed-features.outputs.any_changed == 'true' | |
with: | |
commit_message: Refresh dist files | |
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow | |
- name: Save PR URL | |
env: | |
PR_URL: https://github.com/${{ github.repo.name }}/pull/${{ github.event.number }} | |
run: | | |
mkdir -p ./pr | |
echo $PR_NUMBER > ./pr/pr_url | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pr_url | |
path: pr/ |