Skip to content

Commit 1b7a70a

Browse files
aaronpowellCopilot
andauthored
Run contributor checks from AGT scripts (#1617)
* Run contributor checks from AGT scripts Fetch the pinned AGT contributor check scripts directly and execute them with Python so the workflow no longer depends on missing console entrypoints from the published package. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Log contributor check JSON outputs Dump the raw AGT JSON outputs and stderr logs in the contributor check workflow to make future debugging easier. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4577676 commit 1b7a70a

1 file changed

Lines changed: 56 additions & 4 deletions

File tree

.github/workflows/contributor-check.yml

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,15 @@ jobs:
2929
with:
3030
python-version: "3.12"
3131

32-
- name: Install AGT CLI
33-
run: pip install --quiet 'agent-governance-toolkit==3.3.0'
32+
- name: Fetch AGT check scripts
33+
env:
34+
AGT_REF: v3.3.0
35+
run: |
36+
mkdir -p /tmp/agt
37+
curl -fsSL "https://raw.githubusercontent.com/microsoft/agent-governance-toolkit/${AGT_REF}/scripts/contributor_check.py" \
38+
-o /tmp/agt/contributor_check.py
39+
curl -fsSL "https://raw.githubusercontent.com/microsoft/agent-governance-toolkit/${AGT_REF}/scripts/credential_audit.py" \
40+
-o /tmp/agt/credential_audit.py
3441
3542
- name: Determine author
3643
id: author
@@ -50,21 +57,66 @@ jobs:
5057
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5158
run: |
5259
set +e
53-
agt-contributor-check \
60+
python3 /tmp/agt/contributor_check.py \
5461
--username "${{ steps.author.outputs.username }}" \
62+
--repo "${{ github.repository }}" \
5563
--json > /tmp/profile.json 2>/tmp/profile.log
64+
status=$?
5665
set -e
66+
if [ "$status" -ne 0 ] && [ ! -s /tmp/profile.json ]; then
67+
echo "::warning::Profile check failed"
68+
if [ -s /tmp/profile.log ]; then
69+
sed -n '1,120p' /tmp/profile.log
70+
fi
71+
fi
5772
5873
- name: Run credential audit
5974
env:
6075
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6176
run: |
6277
set +e
63-
agt-credential-audit \
78+
python3 /tmp/agt/credential_audit.py \
6479
--username "${{ steps.author.outputs.username }}" \
6580
--repo "${{ github.repository }}" \
6681
--json > /tmp/cred.json 2>/tmp/cred.log
82+
status=$?
6783
set -e
84+
if [ "$status" -ne 0 ] && [ ! -s /tmp/cred.json ]; then
85+
echo "::warning::Credential audit failed"
86+
if [ -s /tmp/cred.log ]; then
87+
sed -n '1,120p' /tmp/cred.log
88+
fi
89+
fi
90+
91+
- name: Dump check outputs
92+
if: always()
93+
run: |
94+
dump_json() {
95+
label="$1"
96+
file="$2"
97+
log_file="$3"
98+
99+
echo "::group::${label} JSON"
100+
if [ -s "$file" ]; then
101+
if jq . "$file"; then
102+
:
103+
else
104+
cat "$file"
105+
fi
106+
else
107+
echo "<missing>"
108+
fi
109+
echo "::endgroup::"
110+
111+
if [ -s "$log_file" ]; then
112+
echo "::group::${label} stderr"
113+
sed -n '1,120p' "$log_file"
114+
echo "::endgroup::"
115+
fi
116+
}
117+
118+
dump_json "Profile check" /tmp/profile.json /tmp/profile.log
119+
dump_json "Credential audit" /tmp/cred.json /tmp/cred.log
68120
69121
- name: Resolve check risks
70122
id: results

0 commit comments

Comments
 (0)