|  | 
| 15 | 15 |  steps: | 
| 16 | 16 |  - name: Checkout repository | 
| 17 | 17 |  uses: actions/checkout@v2 | 
| 18 |  | - with: | 
| 19 |  | - fetch-depth: 0 # Esto es necesario para acceder al historial completo | 
| 20 | 18 | 
 | 
| 21 | 19 |  - name: Set up Node.js | 
| 22 | 20 |  uses: actions/setup-node@v2 | 
|  | 
| 28 | 26 | 
 | 
| 29 | 27 |  - name: Run tests | 
| 30 | 28 |  run: npm run test:handler | 
| 31 |  | - | 
| 32 |  | - - name: Install jq | 
| 33 |  | - run: sudo apt-get install jq | 
| 34 |  | - | 
| 35 |  | - - name: Generate coverage badge | 
| 36 |  | - run: | | 
| 37 |  | - COVERAGE=$(cat coverage/coverage-summary.json | jq '.total.lines.pct') | 
| 38 |  | - echo "" > coverage/coverage_badge.md | 
| 39 |  | -
 | 
| 40 |  | - - name: Create and switch to a new branch | 
| 41 |  | - run: | | 
| 42 |  | - git checkout -b update-coverage-badge | 
| 43 |  | -
 | 
| 44 |  | - - name: Update README with coverage badge | 
| 45 |  | - run: | | 
| 46 |  | - BADGE_CONTENT=$(cat coverage/coverage_badge.md) | 
| 47 |  | - sed -i "s|!\[Coverage\](.*)|${BADGE_CONTENT}|" README.md | 
| 48 |  | -
 | 
| 49 |  | - - name: Show repository information | 
| 50 |  | - run: | | 
| 51 |  | - echo "Current Repository: $(git remote -v)" | 
| 52 |  | -
 | 
| 53 |  | - - name: Commit and push changes | 
| 54 |  | - run: | | 
| 55 |  | - git config --local user.email "${{ secrets.GIT_USER_EMAIL }}" | 
| 56 |  | - git config --local user.name "${{ secrets.GIT_USER_NAME }}" | 
| 57 |  | - git add README.md | 
| 58 |  | - git commit -m "Update coverage badge" | 
| 59 |  | - git push origin HEAD:update-coverage-badge | 
| 60 |  | -
 | 
| 61 |  | - - name: Create Pull Request | 
| 62 |  | - uses: peter-evans/create-pull-request@v3 | 
| 63 |  | - with: | 
| 64 |  | - title: "Update coverage badge" | 
| 65 |  | - body: "This PR updates the coverage badge in README." | 
| 66 |  | - base: main | 
| 67 |  | - head: update-coverage-badge | 
0 commit comments