Repository navigation
94 lines (90 loc) · 3.73 KB
/
Copy pathcontributors.yml
File metadata and controls
94 lines (90 loc) · 3.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Refresh contributors
on:
workflow_dispatch:
schedule:
- cron: "17 14 * * 3"
permissions:
contents: read
pull-requests: read
concurrency:
group: contributors-${{ github.repository }}
cancel-in-progress: false
jobs:
refresh:
if: github.repository == 'openclaw/openclaw-enterprise'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Validate the manual branch
if: github.event_name == 'workflow_dispatch'
shell: bash
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
set -euo pipefail
if [ -z "$DEFAULT_BRANCH" ] || [ "$GITHUB_REF" != "refs/heads/$DEFAULT_BRANCH" ]; then
echo "::error::Select the current default branch on the Actions page and run this workflow again."
exit 1
fi
- name: Check out the event commit
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ github.sha }}
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1
with:
node-version: "24.22.1"
- name: Refresh the contributor wall
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
set -euo pipefail
status=$(git status --porcelain=v1 --untracked-files=all --ignore-submodules=none)
test -z "$status"
test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
node scripts/update-contributors.ts --expected-base "$GITHUB_SHA"
- name: Export the README patch
id: export
shell: bash
run: |
set -euo pipefail
test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
status=$(git status --porcelain=v1 --untracked-files=all --ignore-submodules=none)
if [[ -z "$status" ]]; then
echo "changed=false" >> "$GITHUB_OUTPUT"
printf "No contributor changes. No artifact uploaded.\n\nBase: \`%s\`\n\nRun: %s, attempt: %s\n" \
"$GITHUB_SHA" "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
test "$status" = ' M README.md'
patch="$RUNNER_TEMP/contributors.patch"
git diff --no-ext-diff --no-textconv --no-color --full-index --binary \
--no-renames --diff-algorithm=myers --no-indent-heuristic \
--src-prefix=a/ --dst-prefix=b/ --unified=3 --inter-hunk-context=0 \
"$GITHUB_SHA" -- README.md > "$patch"
test -s "$patch"
digest=$(sha256sum "$patch")
echo "sha256=${digest%% *}" >> "$GITHUB_OUTPUT"
echo "changed=true" >> "$GITHUB_OUTPUT"
- name: Upload the README patch
id: upload
if: steps.export.outputs.changed == 'true'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
with:
name: contributors-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/contributors.patch
if-no-files-found: error
retention-days: 3
- name: Record the patch for human review
if: steps.export.outputs.changed == 'true' && steps.upload.outcome == 'success'
shell: bash
env:
PATCH_SHA256: ${{ steps.export.outputs.sha256 }}
ARTIFACT_URL: ${{ steps.upload.outputs.artifact-url }}
run: |
set -euo pipefail
test -n "$ARTIFACT_URL"
printf "README patch uploaded; pending human README review.\n\nBase: \`%s\`\n\nPatch SHA-256: \`%s\`\n\nRun: %s, attempt: %s\n\n[Download patch artifact](%s)\n" \
"$GITHUB_SHA" "$PATCH_SHA256" "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" "$ARTIFACT_URL" >> "$GITHUB_STEP_SUMMARY"