How should node
handle non-existent .env
files passed via CLI flags?
#54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Validate vote commit and update participation | |
on: | |
pull_request: | |
types: [synchronize] | |
paths: [votes/**] | |
concurrency: ${{ github.workflow }}--${{ github.head_ref }} | |
permissions: | |
contents: read | |
pull-requests: write | |
repository-projects: read | |
jobs: | |
validate-commit-and-update-participation: | |
if: startsWith(github.head_ref, 'votes/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Compute number of commits in the PR | |
id: nb-of-commits | |
run: | | |
echo "plusOne=$((${{ github.event.pull_request.commits }} + 1))" >> $GITHUB_OUTPUT | |
echo "minusOne=$((${{ github.event.pull_request.commits }} - 1))" >> $GITHUB_OUTPUT | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
fetch-depth: ${{ steps.nb-of-commits.outputs.plusOne }} | |
persist-credentials: false | |
- name: Download nodejs/node mailmap file | |
run: | |
curl -L https://raw.githubusercontent.com/nodejs/node/main/.mailmap >> | |
.mailmap | |
- run: npm install @node-core/caritat | |
- name: Get PR description | |
id: desc | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "markdown<<$EOF" >> "$GITHUB_OUTPUT" | |
gh pr view "${{ github.event.pull_request.html_url }}" --json body --jq '.body' >> "$GITHUB_OUTPUT" | |
echo "$EOF" >> "$GITHUB_OUTPUT" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Get updated vote status | |
id: status | |
run: | |
echo "prStatus=$(./votes/initiateNewVote/getVoteStatus.mjs)" >> | |
"$GITHUB_OUTPUT"; cat "$GITHUB_OUTPUT" | |
env: | |
SUBPATH: ${{ github.head_ref }} | |
FIRST_COMMIT_REF: HEAD^2~${{ steps.nb-of-commits.outputs.minusOne }} | |
LAST_COMMIT_REF: ${{ github.event.after }} | |
CHECK_COMMITS_AFTER: ${{ github.event.before }} | |
PR_DESCRIPTION: ${{steps.desc.outputs.markdown}} | |
- name: Update PR description | |
run: | |
gh pr edit "${{ github.event.pull_request.html_url }}" --body "$BODY" | |
env: | |
BODY: ${{ fromJSON(steps.status.outputs.prStatus).body }} | |
GH_TOKEN: ${{ github.token }} | |
- name: Add comment if some invalid commits were found | |
if: fromJSON(steps.status.outputs.prStatus).hasFailures | |
run: | |
gh pr comment "${{ github.event.pull_request.html_url }}" -b | |
"$SUMMARY" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
SUMMARY: | |
${{ fromJSON(steps.status.outputs.prStatus).invalidCommitReason }} | |
- name: Mark workflow as failed if some invalid commits were found | |
if: fromJSON(steps.status.outputs.prStatus).hasFailures | |
run: 'false' |