From 1e6251edfb00cd5e03e1eb82d7aa8d86be56d644 Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Mon, 14 Oct 2024 13:07:12 -0400 Subject: [PATCH] ci: Fix sanity test checkout ref and shorten APP_VERSION sha usage --- .github/act/actPREvent.json | 164 ++++++++++++++++++++++++++++ .github/workflows/pr.yml | 9 +- .github/workflows/testAndSanity.yml | 6 + 3 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 .github/act/actPREvent.json diff --git a/.github/act/actPREvent.json b/.github/act/actPREvent.json new file mode 100644 index 00000000..69d84d5d --- /dev/null +++ b/.github/act/actPREvent.json @@ -0,0 +1,164 @@ +{ + "action": "synchronize", + "number": 210, + "pull_request": { + "url": "https://api.github.com/repos/FoxxMD/multi-scrobbler/pulls/210", + "id": 2123337348, + "node_id": "PR_kwDOEpP-x85-j46E", + "number": 210, + "state": "open", + "locked": false, + "merge_commit_sha": "349bea1f4580b9e61aa22446eae73f8b1225bbb7", + "labels": [ + { + "id": 2494982061, + "node_id": "MDU6TGFiZWwyNDk0OTgyMDYx", + "url": "https://api.github.com/repos/FoxxMD/multi-scrobbler/labels/bug", + "name": "bug", + "color": "d73a4a", + "default": true, + "description": "Something isn't working" + }, + { + "id": 7131135993, + "node_id": "LA_kwDOEpP-x88AAAABqQx_-Q", + "url": "https://api.github.com/repos/FoxxMD/multi-scrobbler/labels/safe%20to%20test", + "name": "safe to test", + "color": "D4C5F9", + "default": false, + "description": "trusted to build image" + } + ], + "milestone": null, + "draft": false, + "head": { + "label": "FoxxMD:GH-209/jellyfinCleanup", + "ref": "GH-209/jellyfinCleanup", + "sha": "e251da9b8eecfcb3aba8756393e5075d0092794b", + "user": { + "login": "FoxxMD", + "id": 4663766, + "node_id": "MDQ6VXNlcjQ2NjM3NjY=", + "avatar_url": "https://avatars.githubusercontent.com/u/4663766?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/FoxxMD", + "html_url": "https://github.com/FoxxMD", + "followers_url": "https://api.github.com/users/FoxxMD/followers", + "following_url": "https://api.github.com/users/FoxxMD/following{/other_user}", + "gists_url": "https://api.github.com/users/FoxxMD/gists{/gist_id}", + "starred_url": "https://api.github.com/users/FoxxMD/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FoxxMD/subscriptions", + "organizations_url": "https://api.github.com/users/FoxxMD/orgs", + "repos_url": "https://api.github.com/users/FoxxMD/repos", + "events_url": "https://api.github.com/users/FoxxMD/events{/privacy}", + "received_events_url": "https://api.github.com/users/FoxxMD/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 311688903, + "node_id": "MDEwOlJlcG9zaXRvcnkzMTE2ODg5MDM=", + "name": "multi-scrobbler", + "full_name": "FoxxMD/multi-scrobbler", + "private": false, + "owner": { + "login": "FoxxMD", + "id": 4663766, + "node_id": "MDQ6VXNlcjQ2NjM3NjY=", + "avatar_url": "https://avatars.githubusercontent.com/u/4663766?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/FoxxMD", + "html_url": "https://github.com/FoxxMD", + "followers_url": "https://api.github.com/users/FoxxMD/followers", + "following_url": "https://api.github.com/users/FoxxMD/following{/other_user}", + "gists_url": "https://api.github.com/users/FoxxMD/gists{/gist_id}", + "starred_url": "https://api.github.com/users/FoxxMD/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FoxxMD/subscriptions", + "organizations_url": "https://api.github.com/users/FoxxMD/orgs", + "repos_url": "https://api.github.com/users/FoxxMD/repos", + "events_url": "https://api.github.com/users/FoxxMD/events{/privacy}", + "received_events_url": "https://api.github.com/users/FoxxMD/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/FoxxMD/multi-scrobbler", + "description": "Scrobble plays from multiple sources to multiple clients", + "fork": false, + "created_at": "2020-11-10T14:45:38Z", + "updated_at": "2024-10-14T09:21:37Z", + "pushed_at": "2024-10-14T15:43:00Z", + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "visibility": "public", + "forks": 16, + "open_issues": 19, + "watchers": 369, + "default_branch": "master", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "base": { + "label": "FoxxMD:master", + "ref": "master", + "sha": "9c21db8172b6beff9d321e831e9353bf17e92a37", + "repo": { + "id": 311688903, + "node_id": "MDEwOlJlcG9zaXRvcnkzMTE2ODg5MDM=", + "name": "multi-scrobbler", + "full_name": "FoxxMD/multi-scrobbler", + "private": false, + "fork": false, + "created_at": "2020-11-10T14:45:38Z", + "updated_at": "2024-10-14T09:21:37Z", + "pushed_at": "2024-10-14T15:43:00Z", + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "visibility": "public", + "forks": 16, + "open_issues": 19, + "watchers": 369, + "default_branch": "master", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "author_association": "OWNER", + "auto_merge": null, + "active_lock_reason": null, + "merged": false, + "mergeable": null, + "rebaseable": null, + "mergeable_state": "unknown", + "merged_by": null, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 5, + "additions": 84, + "deletions": 28, + "changed_files": 5 + }, + "before": "335ee0cd601f5a82e36643c812507b2b53e7daf0", + "after": "e251da9b8eecfcb3aba8756393e5075d0092794b" + } \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9d4d9b11..acc797d2 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -14,6 +14,8 @@ jobs: test: if: contains(github.event.pull_request.labels.*.name, 'safe to test') uses: ./.github/workflows/testAndSanity.yml + with: + ref: ${{ github.event.pull_request.head.sha }} release-snapshot: name: Release snapshot @@ -66,11 +68,16 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} + - name: Set short git commit SHA + run: | + short=$(echo "${{ github.event.pull_request.head.sha }}" | head -c7) + echo "COMMIT_SHORT_SHA=$short" >> $GITHUB_ENV + - name: Build and push id: docker_build uses: docker/build-push-action@v5 env: - APP_VERSION: ${{ format('pr{0}-{1}', github.event.number, github.event.pull_request.head.sha ) }} + APP_VERSION: ${{ format('pr{0}-{1}', github.event.number, env.COMMIT_SHORT_SHA ) }} with: context: . build-args: | diff --git a/.github/workflows/testAndSanity.yml b/.github/workflows/testAndSanity.yml index 62d7e4a9..6cba8847 100644 --- a/.github/workflows/testAndSanity.yml +++ b/.github/workflows/testAndSanity.yml @@ -8,6 +8,10 @@ on: required: false default: '18.x' type: string + ref: + description: "Ref to checkout" + required: false + type: string jobs: test: @@ -16,6 +20,8 @@ jobs: steps: - name: Check out the repo uses: actions/checkout@v4 + with: + ref: ${{ inputs.ref }} - name: Use Node.js uses: actions/setup-node@v4 with: -- 2.51.2