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

Action fails with output of dist/index.js and without error #331

Closed
peschee opened this issue Nov 6, 2023 · 3 comments
Closed

Action fails with output of dist/index.js and without error #331

peschee opened this issue Nov 6, 2023 · 3 comments

Comments

@peschee
Copy link

peschee commented Nov 6, 2023

I have the following config

      - id: changesets
        uses: changesets/[email protected]
        with:
          publish: npm run release
          version: npm run version
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

and these NPM scripts in my package.json file:

    "release": "is-ci && changeset publish",
    "version": "is-ci && sh scripts/version.sh"

when trying to run the action with changesets available, I'm getting the following output which does not really help me diagnose the issue:

[changeset-release/main d31df50] chore: version packages
 4 files changed, 9 insertions(+), 8 deletions(-)
 delete mode 100644 .changeset/neat-radios-love.md
/usr/bin/git status --porcelain
/usr/bin/git push origin HEAD:changeset-release/main --force
/home/runner/work/_actions/changesets/action/v1.4.5/dist/index.js:1
 __webpack_modules__={87351:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.hasOwnProperty.call(e,r))n(t,e,r);a(t,e);return t};Object.defineProperty(t,"__esModule",{value:true});t.issue=t.issueCommand=void 0;const s=i(r(22037));const o=r(52[78](https://github.com/xxx/xxx/actions/runs/6773738208/job/18409259150#step:7:79));function issueCommand(e,t,r){const n=new Command(e,t,r);process.stdout.write(n.toString()+s.EOL)}t.issueCommand=issueCommand;function issue(e,t=""){issueCommand(e,{},t)}t.issue=issue;const p="::";class Command{constructor(e,t,r){if(!e){e="missing.command"}this.command=e;this.properties=t;this.message=r}toString(){let e=p+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let t=true;for(const r in this.properties){if(this.properties.hasOwnProperty(r)){const n=this.properties[r];if(n){if(t){t=false}else{e+=","}e+=`${r}=${escapeProperty(n)}`}}}}e+=`${p}${escapeData(this.message)}`;return e}}function escapeData(e){return o.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(e){return o.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}},42186:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.hasOwnProperty.call(e,r))n(t,e,r);a(t,e);return t};var s=this&&this.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,a){function fulfilled(e){try{step(n.next(e))}catch(e){a(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){a(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",
…

it seems the version script runs succesfully, the action then fails with

/home/runner/work/_actions/changesets/action/v1.4.5/dist/index.js:1

and the compiled output of the action script?

any ideas?

@gtjamesa
Copy link

gtjamesa commented Nov 7, 2023

I'm having the same issue. I wonder if it's related to #327

@gtjamesa
Copy link

gtjamesa commented Nov 7, 2023

Been debugging this and its a permissions error - the action doesn't have permission to create a pull request in your repository. You can enable this by visiting "Settings -> Actions -> General" and enabling "Allow GitHub Actions to create and approve pull requests"

I also added the following to the workflow

permissions:
  pull-requests: write
  contents: write

@peschee
Copy link
Author

peschee commented Nov 7, 2023

Great catch! I had already activated "Allow GitHub Actions to create and approve pull requests" but was missing the following in my workflow:

pull-requests: write

under permissions. This seems to have fixed my issue.

I only wish the error message would be better in this case.

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

No branches or pull requests

2 participants