From a885e14194e831d760db1d767fc870cd3eb71d3c Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Mon, 19 Aug 2024 12:03:13 +0100 Subject: [PATCH 1/2] fix(add-to-project): Default to local token when running locally --- .github/workflows/add-to-project.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/add-to-project.yml b/.github/workflows/add-to-project.yml index 05ac255..c4e0a00 100644 --- a/.github/workflows/add-to-project.yml +++ b/.github/workflows/add-to-project.yml @@ -24,6 +24,8 @@ env: # Github's terrible version of a 'ternary operator' # https://github.com/actions/runner/issues/409#issuecomment-752775072 PROJECT_URL: ${{ github.repository == 'CQCL/hugrverse-actions' && 'https://github.com/orgs/CQCL-DEV/projects/10' || inputs.project-url }} + # We use a ADD_TO_PROJECT_PAT secret locally. + GITHUB_TOKEN: ${{ secrets.GITHUB_PAT || secrets.ADD_TO_PROJECT_PAT }} jobs: add-to-project: @@ -38,4 +40,4 @@ jobs: - uses: actions/add-to-project@v1.0.2 with: project-url: ${{ env.PROJECT_URL }} - github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} \ No newline at end of file + github-token: ${{ env.GITHUB_TOKEN }} \ No newline at end of file From 1a4beb5c20a5f31bf879062c763b38cd09339e35 Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Mon, 19 Aug 2024 12:06:24 +0100 Subject: [PATCH 2/2] Add missing input message --- .github/workflows/add-to-project.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/add-to-project.yml b/.github/workflows/add-to-project.yml index c4e0a00..afcf2ee 100644 --- a/.github/workflows/add-to-project.yml +++ b/.github/workflows/add-to-project.yml @@ -37,6 +37,11 @@ jobs: run: | echo "The project-url input is required." exit 1 + - name: Fail if GITHUB_PAT is not set + if: env.GITHUB_TOKEN == '' + run: | + echo "The GITHUB_PAT input is required." + exit 1 - uses: actions/add-to-project@v1.0.2 with: project-url: ${{ env.PROJECT_URL }}