From 41cf5408a82b4470f2333e5733335bcf4865beec Mon Sep 17 00:00:00 2001 From: FabrizioCafolla Date: Sun, 2 Jun 2024 11:06:42 +0200 Subject: [PATCH 1/2] fix(ci): add check drift --- .github/workflows/build-website.yml | 31 ++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-website.yml b/.github/workflows/build-website.yml index 5bdcea4..f60b37c 100644 --- a/.github/workflows/build-website.yml +++ b/.github/workflows/build-website.yml @@ -6,6 +6,11 @@ on: - build-website - build-website-command workflow_dispatch: + inputs: + hash-commit: + description: "Hash commit of awesome-italia-opensource" + required: false + default: "" # Permissions for terramform-init action permissions: @@ -22,12 +27,20 @@ jobs: steps: - name: Load ENV run: | - if [ "${{ github.event.client_payload.slash_command.args.named.pr_sha }}" == "" ]; then - echo "COMMIT_SHA=${{ github.sha }}" >> $GITHUB_ENV - else - echo "COMMIT_SHA=${{ github.event.client_payload.slash_command.args.named.pr_sha }}" >> $GITHUB_ENV + branch_name=feat/build-website-${{ github.event_name }}-${{ github.sha }} + commit_sha=${{ github.sha }} + + if [ "${{ inputs.hash-commit }}" != "" ] ; then + branch_name=feat/build-website-awesome-${{ inputs.hash-commit }} + fi + + if [ "${{ github.event.client_payload.slash_command.args.named.pr_sha }}" != "" ]; then + commit_sha=${{ github.event.client_payload.slash_command.args.named.pr_sha }} fi + echo "commit_sha=${commit_sha}" >> $GITHUB_OUTPUT + echo "branch_name=${branch_name}" >> $GITHUB_OUTPUT + - name: Check out code uses: actions/checkout@v4 with: @@ -59,17 +72,25 @@ jobs: AWS_TERRAFORM_STATE_BUCKET: ${{ secrets.AWS_TERRAFORM_STATE_BUCKET }} - name: Build + id: build timeout-minutes: 5 run: | make setup-website VIRTUAL_ENV=false make download make build + if [[ "$(git status -s)" == "" ]] ; then + echo "has_changed=false" >> "$GITHUB_OUTPUT" + else + echo "has_changed=true" >> "$GITHUB_OUTPUT" + fi + - name: Create Pull Request + if: ${{ steps.build.outputs.has_changed == 'true' }} uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.ACTION_WORKFLOWS }} - title: "fix(website): update awesome data" + title: "feat(website): update awesome data" body: "Update awesome data from: ${{ github.event_name }}" commit-message: "Update awesome data from: ${{ github.event_name }}" author: "FabrizioCafolla <${{ secrets.ACTION_EMAIL }}>" From 160a900c54b04b7fcba72bddf413006146ddf39b Mon Sep 17 00:00:00 2001 From: FabrizioCafolla Date: Sun, 2 Jun 2024 17:48:00 +0000 Subject: [PATCH 2/2] Update awesome data from: workflow_dispatch --- website/database/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/database/metadata.json b/website/database/metadata.json index 0d0be69..ef3a1bf 100644 --- a/website/database/metadata.json +++ b/website/database/metadata.json @@ -2,5 +2,5 @@ "hash": "2a2ab58", "ref": "https://github.com/italia-opensource/awesome-italia-opensource.git?ref=2a2ab58", "source": "https://github.com/italia-opensource/awesome-italia-opensource.git", - "date": "Sat Jun 1 23:06:52 UTC 2024" + "date": "Sun Jun 2 17:47:06 UTC 2024" }