Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a github workflow checking for x-maintenance-intent in the opam files of the PR #27221

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/maintenance-intent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: maintenance-intent present

on:
pull_request

jobs:
changed_files:
runs-on: ubuntu-latest
name: Check changed files for x-maintenance-intent field
steps:
- uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45

- name: Find opam files without x-maintenance-intent field
id: missing-intent
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
bn=$(basename ${file})
if [ $bn = "opam" ]; then
maint_int_present=$(grep "^x-maintenance-intent: " ${file} | wc -l || true)
if [ "$maint_int_present" -eq 0 ]; then
echo "- $file" >> maint-int.md
fi;
fi;
done;
if [ -f maint-int.md ]; then
echo "modified=true" >> $GITHUB_OUTPUT
echo "The following opam files lack the x-maintenance-intent field:" > maint-int2.md
echo "" >> maint-int2.md
cat maint-int.md >> maint-int2.md
echo "" >> maint-int2.md
echo "Please look at https://github.com/ocaml/opam-repository/blob/master/governance/policies/archiving.md#specification-of-the-x--fields-used-in-the-archiving-process for further information." >> maint-int2.md
mv maint-int2.md maint-int.md
else
echo "modified=false" >> $GITHUB_OUTPUT
fi

- name: Add PR Comment
if: steps.missing-intent.outputs.modified == 'true'
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: maint-int.md

- name: Write to Job Summary
if: steps.missing-intent.outputs.modified == 'true'
run: cat maint-int.md >> $GITHUB_STEP_SUMMARY
Loading