From 3161b0828e2f46884821599767008d8bf6ca98eb Mon Sep 17 00:00:00 2001 From: Aleksei Khudiakov Date: Thu, 1 Jun 2023 04:17:26 +1000 Subject: [PATCH 1/2] Explicitly set gpg signing key id git should use in IANA importer woprkflow Signed-off-by: Aleksei Khudiakov --- .github/workflows/iana-hostname-list-updater.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/iana-hostname-list-updater.yml b/.github/workflows/iana-hostname-list-updater.yml index 68b4e2b1..d4ed56d7 100644 --- a/.github/workflows/iana-hostname-list-updater.yml +++ b/.github/workflows/iana-hostname-list-updater.yml @@ -42,9 +42,19 @@ jobs: run: | set -e - echo "$SIGNING_SECRET_KEY" > gpg -q --import + SIGNING_KEY_ID=$(echo "$SIGNING_SECRET_KEY" | gpg --import -q --import-options import-show --with-colons | awk -F: '$1=="sec" {print $5; exit}') + if [ -z "$SIGNING_KEY_ID" ] + then + echo "GPG signing key not found in SIGNING_SECRET_KEY" + exit 1 + fi + + echo "Using gpg key $SIGNING_KEY_ID" + git config --local user.email "$GIT_AUTHOR_EMAIL" git config --local user.name "$GIT_AUTHOR_NAME" + git config --local user.signingkey "$SIGNING_KEY_ID" + git config --local commit.gpgsign true env: GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }} From d1d0e53889be11abe45b76b6ed0ae5e48e943ba0 Mon Sep 17 00:00:00 2001 From: Aleksei Khudiakov Date: Thu, 1 Jun 2023 04:50:22 +1000 Subject: [PATCH 2/2] Explicitly specify repo to gh cli Signed-off-by: Aleksei Khudiakov --- .github/workflows/iana-hostname-list-updater.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/iana-hostname-list-updater.yml b/.github/workflows/iana-hostname-list-updater.yml index d4ed56d7..e566d992 100644 --- a/.github/workflows/iana-hostname-list-updater.yml +++ b/.github/workflows/iana-hostname-list-updater.yml @@ -14,7 +14,9 @@ jobs: id: default-branch shell: bash run: | - echo "branch-name=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')" >> $GITHUB_OUTPUT + set -e + + echo "branch-name=$(gh repo view "$GITHUB_REPOSITORY" --json defaultBranchRef --jq '.defaultBranchRef.name')" >> $GITHUB_OUTPUT env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Checkout @@ -71,7 +73,7 @@ jobs: git push --force origin "${USE_BRANCH_NAME}" - PR_STATE=$(gh pr view --json state --jq ".state" "${USE_BRANCH_NAME}" 2>/dev/null || echo "NONE") + PR_STATE=$(gh pr view --repo "$GITHUB_REPOSITORY" --json state --jq ".state" "${USE_BRANCH_NAME}" 2>/dev/null || echo "NONE") if [[ "$PR_STATE" == "OPEN" ]] then @@ -79,7 +81,8 @@ jobs: exit 0 fi - gh pr create --title "Update IANA TLDs for Hostname validator" \ + gh pr create --repo "$GITHUB_REPOSITORY" \ + --title "Update IANA TLDs for Hostname validator" \ --body "Automated update of TLDs from IANA list available at https://data.iana.org/TLD/tlds-alpha-by-domain.txt" \ --label "Enhancement" env: