Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

CLA: comments on the CLA issue are recorded, not failed

Duarte Santose348fc17c42c
diff --git a/.github/workflows/cla-issue.yml b/.github/workflows/cla-issue.yml
new file mode 100644
index 000000000..4df23b7c9
--- /dev/null
+++ b/.github/workflows/cla-issue.yml
@@ -0,0 +1,52 @@
+# Records a CLA signature made as a comment on the pinned CLA issue (#554) in the same file the
+# pull-request check reads (signatures/cla.json on the cla-signatures branch), so an earlier
+# contributor who signed there is never asked again on their next pull request.
+name: CLA (issue)
+
+on:
+ issue_comment:
+ types: [created]
+
+permissions:
+ contents: write
+
+concurrency:
+ group: cla-signatures
+ cancel-in-progress: false
+
+jobs:
+ record:
+ if: github.event.issue.number == 554 && !github.event.issue.pull_request
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v7
+ with:
+ ref: cla-signatures
+ - name: Add the signature
+ env:
+ BODY: ${{ github.event.comment.body }}
+ LOGIN: ${{ github.event.comment.user.login }}
+ UID: ${{ github.event.comment.user.id }}
+ CID: ${{ github.event.comment.id }}
+ AT: ${{ github.event.comment.created_at }}
+ REPO_ID: ${{ github.event.repository.id }}
+ run: |
+ node - <<'JS'
+ const fs = require('fs')
+ const phrase = 'I have read the CLA Document and I hereby sign the CLA'
+ if (process.env.BODY.trim() !== phrase) { console.log('not the sign phrase'); process.exit(0) }
+ const file = 'signatures/cla.json'
+ const data = JSON.parse(fs.readFileSync(file, 'utf8'))
+ const list = data.signedContributors || (data.signedContributors = [])
+ if (list.some(s => String(s.id) === process.env.UID)) { console.log('already signed'); process.exit(0) }
+ list.push({ name: process.env.LOGIN, id: Number(process.env.UID), comment_id: Number(process.env.CID),
+ created_at: process.env.AT, repoId: Number(process.env.REPO_ID), pullRequestNo: 554 })
+ fs.writeFileSync(file, JSON.stringify(data, null, 2) + '\n')
+ console.log('recorded', process.env.LOGIN)
+ JS
+ if ! git diff --quiet; then
+ git config user.name 'github-actions[bot]'
+ git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
+ git commit -qam "@${{ github.event.comment.user.login }} has signed the CLA in #554"
+ git push
+ fi
diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml
index 13e6bb60f..fbf9b09ac 100644
--- a/.github/workflows/cla.yml
+++ b/.github/workflows/cla.yml
@@ -19,7 +19,9 @@ jobs:
cla:
runs-on: ubuntu-latest
steps:
- - if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
+ # Comments on plain issues (the pinned CLA issue #554) are not pull requests: the action
+ # would look for a PR with that number and fail. Those are recorded by cla-issue.yml.
+ - if: (github.event_name == 'issue_comment' && github.event.issue.pull_request && (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA')) || github.event_name == 'pull_request_target'
uses: contributor-assistant/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}