Skip to content

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

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

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

name: maintenance-intent present
on:
pull_request
jobs:
changed_files:
runs-on: ubuntu-latest
name: Evaluate changed-files
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
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
if [ $(basename $file) = "opam" ]; then
grep "^x-maintenance-intent: " $file > /dev/null;
maint_int_present = $?
if [ $maint_int_present -eq 1 ]; 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." >> int-maint2.md
mv maint-int2.md maint-int.md
else
echo "modified=false" >> $GITHUB_OUTPUT
- name: Add PR Comment
if: steps.git-check.outputs.modified == 'true'
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'

Check failure on line 43 in .github/workflows/maintenance-intent.yml

View workflow run for this annotation

GitHub Actions / maintenance-intent present

Invalid workflow file

The workflow is not valid. .github/workflows/maintenance-intent.yml (Line: 43, Col: 9): 'if' is already defined
with:
recreate: true
path: maint-int.md
- name: Write to Job Summary
if: steps.git-check.outputs.modified == 'true'
run: cat maint-int.md >> $GITHUB_STEP_SUMMARY