|
| 1 | +name: Verify MANIFEST.in is up to date |
| 2 | +permissions: |
| 3 | + contents: read |
| 4 | +on: |
| 5 | + push: |
| 6 | + paths: |
| 7 | + - checkbox-ng/** |
| 8 | + - checkbox-support/** |
| 9 | + - .github/workflows/verify-manifest.yaml |
| 10 | + pull_request: |
| 11 | + paths: |
| 12 | + - checkbox-ng/** |
| 13 | + - checkbox-support/** |
| 14 | + - .github/workflows/verify-manifest.yaml |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | +jobs: |
| 18 | + get_path_matrix: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + outputs: |
| 21 | + path: ${{ steps.paths.outputs.paths }} |
| 22 | + steps: |
| 23 | + - name: Checkout Checkbox monorepo |
| 24 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 25 | + with: |
| 26 | + persist-credentials: false |
| 27 | + fetch-depth: 0 |
| 28 | + - name: Fetch all modified paths |
| 29 | + id: paths |
| 30 | + run: | |
| 31 | + CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) |
| 32 | + if [ "$CURRENT_BRANCH" == "main" ]; then |
| 33 | + echo "Workflow triggered on main, diffing with HEAD~1" |
| 34 | + DIFF=$(git diff --name-only HEAD~1) |
| 35 | + else |
| 36 | + echo "Workflow triggered on a branch, diffing with origin/main" |
| 37 | + DIFF=$(git diff --name-only origin/main) |
| 38 | + fi |
| 39 | + # Checks if a specific path has changed |
| 40 | + changed(){ echo "$DIFF" | grep -o $1; } |
| 41 | + if changed ".github/workflows/verify-manifest.yaml"; then |
| 42 | + # when changing the workflow, re-test all tox to check they still work |
| 43 | + echo "The workflow has been changed, all tox will be retriggered" |
| 44 | + changed(){ true; } |
| 45 | + fi; |
| 46 | +
|
| 47 | + echo -n "paths=[" >> to_output |
| 48 | + for path in \ |
| 49 | + checkbox-ng \ |
| 50 | + checkbox-support; do |
| 51 | + if changed $path; then |
| 52 | + echo -n "\"$path\"," >> to_output |
| 53 | + fi; |
| 54 | + done |
| 55 | + sed -i '$ s/.$//' to_output |
| 56 | + echo -n "]" >> to_output |
| 57 | +
|
| 58 | + cat to_output >> $GITHUB_STEP_SUMMARY |
| 59 | + cat to_output >> $GITHUB_OUTPUT |
| 60 | +
|
| 61 | + check_manifest_path: |
| 62 | + needs: get_path_matrix |
| 63 | + strategy: |
| 64 | + fail-fast: false |
| 65 | + matrix: |
| 66 | + path: ${{ fromJson(needs.get_path_matrix.outputs.path) }} |
| 67 | + name: Verify MANIFEST.in for ${{ matrix.path }} |
| 68 | + defaults: |
| 69 | + run: |
| 70 | + working-directory: ${{ matrix.path }} |
| 71 | + runs-on: 'ubuntu-latest' |
| 72 | + steps: |
| 73 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 74 | + with: |
| 75 | + persist-credentials: false |
| 76 | + - name: Install dependencies |
| 77 | + run: | |
| 78 | + sudo apt-get update |
| 79 | + sudo apt-get install -y -qq check-manifest |
| 80 | + - name: Run check-manifest |
| 81 | + run: check-manifest |
0 commit comments