Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide correct SHA for GitHub actions (#67) #69

Merged
merged 14 commits into from
Mar 4, 2022

Conversation

vincent-psarga
Copy link
Contributor

@vincent-psarga vincent-psarga commented Feb 1, 2022

Description

See issue #67

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • My change needed additional tests
    • I have added tests to cover my changes.
  • Languages:
    • Javascript
    • Java
    • Ruby
  • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

@quine-bot
Copy link

quine-bot bot commented Feb 1, 2022

👋 Figuring out if a PR is useful is hard, hopefully this will help.

  • @vincent-psarga has been on GitHub since 2010 and in that time has had 134 public PRs merged
  • Don't you recognize them? They've been here before 🎉
  • Here's a good example of their work: docs-services (IBM Bluemix Service 3rd party service docs)
  • From looking at their profile, they seem to be good with JavaScript and Ruby.

Their most recently public accepted PR is: hiptest/ember-easy-datatable#65

@aslakhellesoy
Copy link
Contributor

FYI, the event file pointed to by $GITHUB_EVENT_PATH looks like this:

{
  "action": "synchronize",
  "after": "3738117e3337e54955580f4e98cf767d96b42135",
  "before": "06aa815724888e86f37e41e43e07b0ec1bb0ffe1",
  "enterprise": {
    "avatar_url": "https://avatars.githubusercontent.com/b/73?v=4",
    "created_at": "2019-03-28T18:50:55Z",
    "description": null,
    "html_url": "https://github.com/enterprises/smartbear",
    "id": 73,
    "name": "SmartBear",
    "node_id": "MDEwOkVudGVycHJpc2U3Mw==",
    "slug": "smartbear",
    "updated_at": "2022-01-26T22:48:12Z",
    "website_url": null
  },
  "number": 3,
  "organization": {
    "avatar_url": "https://avatars.githubusercontent.com/u/1644671?v=4",
    "description": "Think Bigger. Build Smarter.",
    "events_url": "https://api.github.com/orgs/SmartBear/events",
    "hooks_url": "https://api.github.com/orgs/SmartBear/hooks",
    "id": 1644671,
    "issues_url": "https://api.github.com/orgs/SmartBear/issues",
    "login": "SmartBear",
    "members_url": "https://api.github.com/orgs/SmartBear/members{/member}",
    "node_id": "MDEyOk9yZ2FuaXphdGlvbjE2NDQ2NzE=",
    "public_members_url": "https://api.github.com/orgs/SmartBear/public_members{/member}",
    "repos_url": "https://api.github.com/orgs/SmartBear/repos",
    "url": "https://api.github.com/orgs/SmartBear"
  },
  "pull_request": {
    "_links": {
      "comments": {
        "href": "https://api.github.com/repos/SmartBear/cucumber-expressions/issues/3/comments"
      },
      "commits": {
        "href": "https://api.github.com/repos/SmartBear/cucumber-expressions/pulls/3/commits"
      },
      "html": {
        "href": "https://github.com/SmartBear/cucumber-expressions/pull/3"
      },
      "issue": {
        "href": "https://api.github.com/repos/SmartBear/cucumber-expressions/issues/3"
      },
      "review_comment": {
        "href": "https://api.github.com/repos/SmartBear/cucumber-expressions/pulls/comments{/number}"
    "merges_url": "https://api.github.com/repos/SmartBear/cucumber-expressions/merges",
    "milestones_url": "https://api.github.com/repos/SmartBear/cucumber-expressions/milestones{/number}",
    "mirror_url": null,
    "name": "cucumber-expressions",
    "node_id": "R_kgDOGu4vqA",
    "notifications_url": "https://api.github.com/repos/SmartBear/cucumber-expressions/notifications{?since,all,participating}",
    "open_issues": 2,
    "open_issues_count": 2,
    "owner": {
      "avatar_url": "https://avatars.githubusercontent.com/u/1644671?v=4",
      "events_url": "https://api.github.com/users/SmartBear/events{/privacy}",
      "followers_url": "https://api.github.com/users/SmartBear/followers",
      "following_url": "https://api.github.com/users/SmartBear/following{/other_user}",
      "gists_url": "https://api.github.com/users/SmartBear/gists{/gist_id}",
      "gravatar_id": "",
      "html_url": "https://github.com/SmartBear",
      "id": 1644671,
      "login": "SmartBear",
      "node_id": "MDEyOk9yZ2FuaXphdGlvbjE2NDQ2NzE=",
      "organizations_url": "https://api.github.com/users/SmartBear/orgs",
      "received_events_url": "https://api.github.com/users/SmartBear/received_events",
      "repos_url": "https://api.github.com/users/SmartBear/repos",
      "site_admin": false,
      "starred_url": "https://api.github.com/users/SmartBear/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/SmartBear/subscriptions",
      "type": "Organization",
      "url": "https://api.github.com/users/SmartBear"
    },
    "private": true,
    "pulls_url": "https://api.github.com/repos/SmartBear/cucumber-expressions/pulls{/number}",
    "pushed_at": "2022-02-01T09:22:19Z",
    "releases_url": "https://api.github.com/repos/SmartBear/cucumber-expressions/releases{/id}",
    "size": 5235,
    "ssh_url": "[email protected]:SmartBear/cucumber-expressions.git",
    "stargazers_count": 0,
    "stargazers_url": "https://api.github.com/repos/SmartBear/cucumber-expressions/stargazers",
    "statuses_url": "https://api.github.com/repos/SmartBear/cucumber-expressions/statuses/{sha}",
    "subscribers_url": "https://api.github.com/repos/SmartBear/cucumber-expressions/subscribers",
    "subscription_url": "https://api.github.com/repos/SmartBear/cucumber-expressions/subscription",
    "svn_url": "https://github.com/SmartBear/cucumber-expressions",
    "tags_url": "https://api.github.com/repos/SmartBear/cucumber-expressions/tags",
    "teams_url": "https://api.github.com/repos/SmartBear/cucumber-expressions/teams",
    "topics": [],
    "trees_url": "https://api.github.com/repos/SmartBear/cucumber-expressions/git/trees{/sha}",
    "updated_at": "2022-01-25T13:34:50Z",
    "url": "https://api.github.com/repos/SmartBear/cucumber-expressions",
    "visibility": "internal",
    "watchers": 0,
    "watchers_count": 0
  },
  "sender": {
    "avatar_url": "https://avatars.githubusercontent.com/u/1000?v=4",
    "events_url": "https://api.github.com/users/aslakhellesoy/events{/privacy}",
    "followers_url": "https://api.github.com/users/aslakhellesoy/followers",
    "following_url": "https://api.github.com/users/aslakhellesoy/following{/other_user}",
    "gists_url": "https://api.github.com/users/aslakhellesoy/gists{/gist_id}",
    "gravatar_id": "",
    "html_url": "https://github.com/aslakhellesoy",
    "id": 1000,
    "login": "aslakhellesoy",
    "node_id": "MDQ6VXNlcjEwMDA=",
    "organizations_url": "https://api.github.com/users/aslakhellesoy/orgs",
    "received_events_url": "https://api.github.com/users/aslakhellesoy/received_events",
    "repos_url": "https://api.github.com/users/aslakhellesoy/repos",
    "site_admin": false,
    "starred_url": "https://api.github.com/users/aslakhellesoy/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/aslakhellesoy/subscriptions",
    "type": "User",
    "url": "https://api.github.com/users/aslakhellesoy"
  }
}

For the Java implementation we don't want to use a JSON parser, but we can probably extract it with a regexp like /^\s+"before":\s*"([^"]+)"/

The idea was to do an acceptance test, but running `git rev-parse HEAD` does not
show the "correct" SHA (it shows the same than the GITHUB_SHA env var)
@aslakhellesoy aslakhellesoy marked this pull request as ready for review March 3, 2022 18:01
@aslakhellesoy aslakhellesoy merged commit fd66dc7 into main Mar 4, 2022
@aslakhellesoy aslakhellesoy deleted the 67-use-correct-SHA-for-GHA branch March 4, 2022 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants