|
1 | 1 | name: Links
|
2 | 2 |
|
| 3 | +# cSpell:ignore nvmrc opentelemetrybot |
3 | 4 | on:
|
4 | 5 | merge_group:
|
5 | 6 | pull_request:
|
6 | 7 |
|
| 8 | +env: |
| 9 | + CHANGED_FILES: |
| 10 | + PR_NUM: ${{ github.event.pull_request.number }} |
| 11 | + |
| 12 | + USER_NAME: opentelemetrybot |
| 13 | + |
7 | 14 | jobs:
|
8 | 15 | build-and-check-links:
|
9 | 16 | name: BUILD and CHECK LINKS
|
@@ -42,12 +49,12 @@ jobs:
|
42 | 49 | echo "submodule(s); or undo the submodule update(s) if it happened by mistake."
|
43 | 50 | npm run _diff:fail
|
44 | 51 |
|
45 |
| - - run: npm run log:check:links |
| 52 | + - run: | |
| 53 | + npm run log:check:links |
| 54 | + CHANGED_FILES=$(git status --porcelain) |
| 55 | + echo "CHANGED_FILES=$CHANGED_FILES" >> "$GITHUB_ENV" |
46 | 56 | continue-on-error: true
|
47 |
| - - name: Any files need updating? |
48 |
| - run: | |
49 |
| - echo "If the diff fails due to .htmltest, then either run 'npm run fix:htmltest-config' locally or '/fix:htmltest-config' in GitHub" |
50 |
| - npm run _diff:fail |
| 57 | +
|
51 | 58 | - uses: actions/upload-artifact@v4
|
52 | 59 | with:
|
53 | 60 | name: build-log-etc
|
|
56 | 63 | tmp/package*.json
|
57 | 64 | static/refcache.json
|
58 | 65 |
|
| 66 | + - name: Push changes if any, and fail check |
| 67 | + if: ${{ env.CHANGED_FILES }} |
| 68 | + run: | |
| 69 | + echo "Changes detected in the refcache etc:" |
| 70 | + git status --short |
| 71 | +
|
| 72 | + echo 'cmd: gh pr checkout $PR_NUM -b "pr-check-links-${RANDOM}"' |
| 73 | + # git branch -v |
| 74 | + |
| 75 | + # git config --local user.email "$USER_EMAIL" |
| 76 | + # git config --local user.name "$USER_NAME" |
| 77 | + # git add -A |
| 78 | + # git commit -m "Updates from build-and-check-links workflow" |
| 79 | + |
| 80 | + # echo "\nPushing changes to PR." |
| 81 | + # current_branch=$(git rev-parse --abbrev-ref HEAD) |
| 82 | + # echo current_branch=$current_branch |
| 83 | + # # gh pr checkout sets some git configs that we can use to make sure |
| 84 | + # # we push to the right repo & to the right branch |
| 85 | + # remote_repo=$(git config --get branch.${current_branch}.remote) |
| 86 | + # echo remote_repo=$remote_repo |
| 87 | + # remote_branch=$(git config --get branch.${current_branch}.merge) |
| 88 | + # echo remote_branch=$remote_branch |
| 89 | + # git push ${remote_repo} HEAD:${remote_branch} |
| 90 | + |
| 91 | + # echo "Failing workflow so that changes can be reviewed, and checks rerun." |
| 92 | + # exit 1 |
| 93 | + # env: |
| 94 | + # GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} |
| 95 | + |
59 | 96 | check-refcache:
|
60 | 97 | name: REFCACHE updates?
|
61 | 98 | needs: build-and-check-links
|
|
67 | 104 | - name: Fail when refcache contains entries with HTTP status 4XX
|
68 | 105 | run: |
|
69 | 106 | if grep -B 1 -e '"StatusCode": 4' static/refcache.json; then
|
70 |
| - echo "Run 'npx gulp prune' to remove 4xx entries from the refcache" |
| 107 | + echo "Run 'npm run _refcache:prune' to remove 404 entries from refcache.json," |
| 108 | + echo "or run './scripts/double-check-refcache-400s.mjs' locally to address" |
| 109 | + echo "other 400-status entries." |
71 | 110 | exit 1
|
72 | 111 | fi
|
73 | 112 | - name: Does the refcache need updating?
|
|
0 commit comments