diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a14062e..124b16b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - - uses: actions/setup-node@v4 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: "22" - name: Listener and engine parse diff --git a/tests/test_workflow_pins.py b/tests/test_workflow_pins.py new file mode 100644 index 0000000..55d3f9d --- /dev/null +++ b/tests/test_workflow_pins.py @@ -0,0 +1,21 @@ +from pathlib import Path +import re +import unittest + + +class WorkflowPinTests(unittest.TestCase): + def test_setup_node_is_immutable_and_node24_compatible(self): + workflow_path = Path(__file__).parents[1] / ".github" / "workflows" / "ci.yml" + if not workflow_path.exists(): + self.skipTest("repository workflow is not part of the packaged artifact") + workflow = workflow_path.read_text(encoding="utf-8") + matches = re.findall(r"actions/setup-node@([^\s#]+)", workflow) + self.assertEqual(matches, ["820762786026740c76f36085b0efc47a31fe5020"]) + self.assertIn( + "actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0", + workflow, + ) + + +if __name__ == "__main__": + unittest.main()