From 4e991d6483ad2d9636a81bb50d23e924e9116124 Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Mon, 22 Jul 2024 13:56:54 +0200 Subject: [PATCH 01/18] always pat --- .github/workflows/checks.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index c6ba253b..c0fa1017 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -21,13 +21,9 @@ jobs: echo "has_pat=${{ secrets.GIX_CREATE_PR_PAT != '' }}" >> $GITHUB_OUTPUT - name: Checkout - if: steps.check_pat.outputs.has_pat == 'true' uses: actions/checkout@v3 with: token: ${{ secrets.GIX_CREATE_PR_PAT }} - - name: Checkout without personal access token - if: steps.check_pat.outputs.has_pat == 'false' - uses: actions/checkout@v3 - name: Install shfmt run: sudo snap install --classic shfmt From 8045050212f9e19688be05561b6580577aaaf45f Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Mon, 22 Jul 2024 14:00:23 +0200 Subject: [PATCH 02/18] v4 --- .github/workflows/checks.yml | 2 +- bin/dfx-software-ic-latest | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index c0fa1017..70d30cfa 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -21,7 +21,7 @@ jobs: echo "has_pat=${{ secrets.GIX_CREATE_PR_PAT != '' }}" >> $GITHUB_OUTPUT - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: token: ${{ secrets.GIX_CREATE_PR_PAT }} diff --git a/bin/dfx-software-ic-latest b/bin/dfx-software-ic-latest index d372f2d8..95f71f0e 100755 --- a/bin/dfx-software-ic-latest +++ b/bin/dfx-software-ic-latest @@ -54,7 +54,7 @@ fi ( git fetch if test -n "${IC_COMMIT_BEFORE:-}"; then - IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" + IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" elif test -n "${IC_COMMIT_AFTER:-}"; then IC_COMMIT="$IC_COMMIT_AFTER" else From 24e44e294aa9e74792e17010fb9e1fd0d8d6ce2f Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 12:00:46 +0000 Subject: [PATCH 03/18] Updating formatting --- bin/dfx-software-ic-latest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/dfx-software-ic-latest b/bin/dfx-software-ic-latest index 95f71f0e..d372f2d8 100755 --- a/bin/dfx-software-ic-latest +++ b/bin/dfx-software-ic-latest @@ -54,7 +54,7 @@ fi ( git fetch if test -n "${IC_COMMIT_BEFORE:-}"; then - IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" + IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" elif test -n "${IC_COMMIT_AFTER:-}"; then IC_COMMIT="$IC_COMMIT_AFTER" else From 62eb5d22091ddeb0eb64a8dce6a945cce146bfba Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Mon, 22 Jul 2024 14:02:07 +0200 Subject: [PATCH 04/18] 914 --- .github/workflows/checks.yml | 2 +- bin/dfx-software-ic-latest | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 70d30cfa..3560cb41 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -42,7 +42,7 @@ jobs: fi - name: Commit Formatting changes if: steps.check_pat.outputs.has_pat == 'true' && steps.check_format.outputs.formatting_needed == 'true' - uses: EndBug/add-and-commit@v7.2.0 + uses: EndBug/add-and-commit@v9.1.4 with: add: . default_author: github_actions diff --git a/bin/dfx-software-ic-latest b/bin/dfx-software-ic-latest index d372f2d8..95f71f0e 100755 --- a/bin/dfx-software-ic-latest +++ b/bin/dfx-software-ic-latest @@ -54,7 +54,7 @@ fi ( git fetch if test -n "${IC_COMMIT_BEFORE:-}"; then - IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" + IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" elif test -n "${IC_COMMIT_AFTER:-}"; then IC_COMMIT="$IC_COMMIT_AFTER" else From b13cdadcb2b921b8eb49367c5a0ab11d7ddfffef Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Mon, 22 Jul 2024 14:05:20 +0200 Subject: [PATCH 05/18] ref --- .github/workflows/checks.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 3560cb41..c1cd2260 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -23,6 +23,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: + ref: ${{ github.event.pull_request.head.ref }} token: ${{ secrets.GIX_CREATE_PR_PAT }} - name: Install shfmt From 050d88bbffebe1390a501bb40ff0c950db30e83e Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 12:05:50 +0000 Subject: [PATCH 06/18] Updating formatting --- bin/dfx-software-ic-latest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/dfx-software-ic-latest b/bin/dfx-software-ic-latest index 95f71f0e..d372f2d8 100755 --- a/bin/dfx-software-ic-latest +++ b/bin/dfx-software-ic-latest @@ -54,7 +54,7 @@ fi ( git fetch if test -n "${IC_COMMIT_BEFORE:-}"; then - IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" + IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" elif test -n "${IC_COMMIT_AFTER:-}"; then IC_COMMIT="$IC_COMMIT_AFTER" else From 4ca50d51a131fb76511371d81ce831fe596c42f7 Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Mon, 22 Jul 2024 14:06:17 +0200 Subject: [PATCH 07/18] repo --- .github/workflows/checks.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index c1cd2260..bf721a47 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -23,6 +23,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: + repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} token: ${{ secrets.GIX_CREATE_PR_PAT }} From d99e257bc839c52840b8479d12cd294ca08ccf1e Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Mon, 22 Jul 2024 14:08:15 +0200 Subject: [PATCH 08/18] bad formatted --- bin/dfx-software-ic-latest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/dfx-software-ic-latest b/bin/dfx-software-ic-latest index d372f2d8..95f71f0e 100755 --- a/bin/dfx-software-ic-latest +++ b/bin/dfx-software-ic-latest @@ -54,7 +54,7 @@ fi ( git fetch if test -n "${IC_COMMIT_BEFORE:-}"; then - IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" + IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" elif test -n "${IC_COMMIT_AFTER:-}"; then IC_COMMIT="$IC_COMMIT_AFTER" else From 434714193189b65ec651618f4f38e36035327376 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 12:08:46 +0000 Subject: [PATCH 09/18] Updating formatting --- bin/dfx-software-ic-latest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/dfx-software-ic-latest b/bin/dfx-software-ic-latest index 95f71f0e..d372f2d8 100755 --- a/bin/dfx-software-ic-latest +++ b/bin/dfx-software-ic-latest @@ -54,7 +54,7 @@ fi ( git fetch if test -n "${IC_COMMIT_BEFORE:-}"; then - IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" + IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" elif test -n "${IC_COMMIT_AFTER:-}"; then IC_COMMIT="$IC_COMMIT_AFTER" else From 1aae50100b1f9c88200b36d51180788c41c7aa79 Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Mon, 22 Jul 2024 14:11:22 +0200 Subject: [PATCH 10/18] bad formatting --- bin/dfx-software-ic-latest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/dfx-software-ic-latest b/bin/dfx-software-ic-latest index d372f2d8..95f71f0e 100755 --- a/bin/dfx-software-ic-latest +++ b/bin/dfx-software-ic-latest @@ -54,7 +54,7 @@ fi ( git fetch if test -n "${IC_COMMIT_BEFORE:-}"; then - IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" + IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" elif test -n "${IC_COMMIT_AFTER:-}"; then IC_COMMIT="$IC_COMMIT_AFTER" else From 99e9ed49134a52c1b3db95905a96d96e4fcdd9f2 Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Mon, 22 Jul 2024 14:20:49 +0200 Subject: [PATCH 11/18] can_add_commit --- .github/workflows/checks.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index bf721a47..d3c54b1c 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -18,9 +18,13 @@ jobs: - name: Check if personal access token is available id: check_pat run: | - echo "has_pat=${{ secrets.GIX_CREATE_PR_PAT != '' }}" >> $GITHUB_OUTPUT + echo "can_add_commit=${{ secrets.GIX_CREATE_PR_PAT != '' && github.event_name == 'pull_request' }}" >> $GITHUB_OUTPUT - name: Checkout + if: steps.check_pat.outputs.can_add_commit == 'false' + uses: actions/checkout@v4 + - name: Checkout + if: steps.check_pat.outputs.can_add_commit == 'true' uses: actions/checkout@v4 with: repository: ${{ github.event.pull_request.head.repo.full_name }} From 8c94b2dd5f9c70bce5e0e61275cb87e7add08ba3 Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Mon, 22 Jul 2024 14:22:40 +0200 Subject: [PATCH 12/18] can_add_commit2 --- .github/workflows/checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index d3c54b1c..b57388ec 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -47,7 +47,7 @@ jobs: echo "formatting_needed=true" >> $GITHUB_OUTPUT fi - name: Commit Formatting changes - if: steps.check_pat.outputs.has_pat == 'true' && steps.check_format.outputs.formatting_needed == 'true' + if: steps.check_pat.outputs.can_add_commit == 'true' && steps.check_format.outputs.formatting_needed == 'true' uses: EndBug/add-and-commit@v9.1.4 with: add: . @@ -58,7 +58,7 @@ jobs: pull_strategy: "NO-PULL" - name: Fail for formatting issues without personal access token - if: steps.check_pat.outputs.has_pat == 'false' && steps.check_format.outputs.formatting_needed == 'true' + if: steps.check_pat.outputs.can_add_commit == 'false' && steps.check_format.outputs.formatting_needed == 'true' run: | echo "Formatting changes are needed but couldn't be committed because the personal access token isn't available." exit 1 From 6c3449d8ab21d669eac6f9f3920dedffef066465 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 12:23:03 +0000 Subject: [PATCH 13/18] Updating formatting --- bin/dfx-software-ic-latest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/dfx-software-ic-latest b/bin/dfx-software-ic-latest index 95f71f0e..d372f2d8 100755 --- a/bin/dfx-software-ic-latest +++ b/bin/dfx-software-ic-latest @@ -54,7 +54,7 @@ fi ( git fetch if test -n "${IC_COMMIT_BEFORE:-}"; then - IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" + IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" elif test -n "${IC_COMMIT_AFTER:-}"; then IC_COMMIT="$IC_COMMIT_AFTER" else From 72ea47c4c89abd55b539b38d2f2cf7161a351393 Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Mon, 22 Jul 2024 14:25:58 +0200 Subject: [PATCH 14/18] check_can_add_commit --- .github/workflows/checks.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index b57388ec..560364c5 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -16,15 +16,15 @@ jobs: # changes and instead just fail if the formatting is incorrect. steps: - name: Check if personal access token is available - id: check_pat + id: check_can_add_commit run: | echo "can_add_commit=${{ secrets.GIX_CREATE_PR_PAT != '' && github.event_name == 'pull_request' }}" >> $GITHUB_OUTPUT - name: Checkout - if: steps.check_pat.outputs.can_add_commit == 'false' + if: steps.check_can_add_commit.outputs.can_add_commit == 'false' uses: actions/checkout@v4 - name: Checkout - if: steps.check_pat.outputs.can_add_commit == 'true' + if: steps.check_can_add_commit.outputs.can_add_commit == 'true' uses: actions/checkout@v4 with: repository: ${{ github.event.pull_request.head.repo.full_name }} @@ -47,7 +47,7 @@ jobs: echo "formatting_needed=true" >> $GITHUB_OUTPUT fi - name: Commit Formatting changes - if: steps.check_pat.outputs.can_add_commit == 'true' && steps.check_format.outputs.formatting_needed == 'true' + if: steps.check_can_add_commit.outputs.can_add_commit == 'true' && steps.check_format.outputs.formatting_needed == 'true' uses: EndBug/add-and-commit@v9.1.4 with: add: . @@ -58,9 +58,9 @@ jobs: pull_strategy: "NO-PULL" - name: Fail for formatting issues without personal access token - if: steps.check_pat.outputs.can_add_commit == 'false' && steps.check_format.outputs.formatting_needed == 'true' + if: steps.check_can_add_commit.outputs.can_add_commit == 'false' && steps.check_format.outputs.formatting_needed == 'true' run: | - echo "Formatting changes are needed but couldn't be committed because the personal access token isn't available." + echo "Formatting changes are needed but couldn't be committed because the personal access token isn't available or this isn't a pull request." exit 1 shell-checks: needs: formatting From 5a498c156d31d2bd5237687c6299445bac6809e8 Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Mon, 22 Jul 2024 14:26:28 +0200 Subject: [PATCH 15/18] check_can_add_commit2 --- .github/workflows/checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 560364c5..d7756cc2 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -15,7 +15,7 @@ jobs: # users. So on PRs where the token is not available, we don't commit # changes and instead just fail if the formatting is incorrect. steps: - - name: Check if personal access token is available + - name: Check if commits can be added id: check_can_add_commit run: | echo "can_add_commit=${{ secrets.GIX_CREATE_PR_PAT != '' && github.event_name == 'pull_request' }}" >> $GITHUB_OUTPUT From d626071e312db646f223ac494418db1affea6801 Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Mon, 22 Jul 2024 14:27:51 +0200 Subject: [PATCH 16/18] reorder --- .github/workflows/checks.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index d7756cc2..da17d03a 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -20,9 +20,6 @@ jobs: run: | echo "can_add_commit=${{ secrets.GIX_CREATE_PR_PAT != '' && github.event_name == 'pull_request' }}" >> $GITHUB_OUTPUT - - name: Checkout - if: steps.check_can_add_commit.outputs.can_add_commit == 'false' - uses: actions/checkout@v4 - name: Checkout if: steps.check_can_add_commit.outputs.can_add_commit == 'true' uses: actions/checkout@v4 @@ -30,6 +27,9 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} token: ${{ secrets.GIX_CREATE_PR_PAT }} + - name: Checkout + if: steps.check_can_add_commit.outputs.can_add_commit == 'false' + uses: actions/checkout@v4 - name: Install shfmt run: sudo snap install --classic shfmt From 6854b9234bcff2c5757e25fb98023c84d29d9c82 Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Mon, 22 Jul 2024 14:29:57 +0200 Subject: [PATCH 17/18] bad formatting --- bin/dfx-software-ic-latest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/dfx-software-ic-latest b/bin/dfx-software-ic-latest index d372f2d8..95f71f0e 100755 --- a/bin/dfx-software-ic-latest +++ b/bin/dfx-software-ic-latest @@ -54,7 +54,7 @@ fi ( git fetch if test -n "${IC_COMMIT_BEFORE:-}"; then - IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" + IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" elif test -n "${IC_COMMIT_AFTER:-}"; then IC_COMMIT="$IC_COMMIT_AFTER" else From d6913d369e57551b25401f4dbd8a01e0867bcd19 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 12:30:27 +0000 Subject: [PATCH 18/18] Updating formatting --- bin/dfx-software-ic-latest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/dfx-software-ic-latest b/bin/dfx-software-ic-latest index 95f71f0e..d372f2d8 100755 --- a/bin/dfx-software-ic-latest +++ b/bin/dfx-software-ic-latest @@ -54,7 +54,7 @@ fi ( git fetch if test -n "${IC_COMMIT_BEFORE:-}"; then - IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" + IC_COMMIT="$(git log --pretty=%P -n 1 "$IC_COMMIT_BEFORE" | awk '{print $(NF)}')" elif test -n "${IC_COMMIT_AFTER:-}"; then IC_COMMIT="$IC_COMMIT_AFTER" else