diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4280c2f..595abcd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,9 @@ on: - 'pyproject.toml' - 'tests/**' +permissions: + contents: read + jobs: pre-commit: runs-on: ubuntu-latest diff --git a/.github/workflows/scheduled-lint.yml b/.github/workflows/scheduled-lint.yml index 5b8407b..d7785c2 100644 --- a/.github/workflows/scheduled-lint.yml +++ b/.github/workflows/scheduled-lint.yml @@ -6,6 +6,9 @@ on: - cron: '0 9 * * 1' workflow_dispatch: +permissions: + contents: read + jobs: scheduled-pre-commit: runs-on: ubuntu-latest @@ -28,18 +31,21 @@ jobs: - name: Run pre-commit checks id: precommit run: | - uv run --extra dev pre-commit run --all-files > precommit_output.txt 2>&1 - EXIT_CODE=$? + EXIT_CODE=0 + uv run --extra dev pre-commit run --all-files > precommit_output.txt 2>&1 || EXIT_CODE=$? OUTPUT=$(cat precommit_output.txt) - echo "output<> $GITHUB_OUTPUT - echo "$OUTPUT" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - if [ $EXIT_CODE -eq 0 ]; then - echo "status=success" >> $GITHUB_OUTPUT + echo "$OUTPUT" + { + echo "output<> "$GITHUB_OUTPUT" + + if [ "$EXIT_CODE" -eq 0 ]; then + echo "status=success" >> "$GITHUB_OUTPUT" else - echo "status=failed" >> $GITHUB_OUTPUT + echo "status=failed" >> "$GITHUB_OUTPUT" exit 1 fi @@ -57,18 +63,21 @@ jobs: - name: Run markdown checks id: markdown run: | - pymarkdownlnt scan docs > markdown_output.txt 2>&1 - EXIT_CODE=$? + EXIT_CODE=0 + pymarkdownlnt scan docs > markdown_output.txt 2>&1 || EXIT_CODE=$? OUTPUT=$(cat markdown_output.txt) - echo "output<> $GITHUB_OUTPUT - echo "$OUTPUT" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - if [ $EXIT_CODE -eq 0 ]; then - echo "status=success" >> $GITHUB_OUTPUT + echo "$OUTPUT" + { + echo "output<> "$GITHUB_OUTPUT" + + if [ "$EXIT_CODE" -eq 0 ]; then + echo "status=success" >> "$GITHUB_OUTPUT" else - echo "status=failed" >> $GITHUB_OUTPUT + echo "status=failed" >> "$GITHUB_OUTPUT" exit 1 fi